JSFiddle - React, Tailwind, and code Playground
by kyleshen
HTML
<div id='DivFirst'>這是第一個Div</div>
<div id='DivSecond' style='display:none;'>這是第二個Div</div>
<br />
<input type='button' value='顯示第二個' id='btnShow' />
<br />
<br />
<a href='http://www.google.com.tw' >導頁</a>
JavaScript
$(function(){
sessionStorage.length;
$('#btnShow').click(function(){
$('#DivSecond').show();
sessionStorage.setItem('ShowSecond', "Y");
});
//如果SessionStorage存在時,秀出第二個DIV
if (sessionStorage.getItem("ShowSecond") == "Y") {
$('#DivSecond').show();
}
});