Working on Session storage where in the first page I have a drop down if user select (.bap_mjr) value from the drop-down and click next button from the first page It will redirect to the second page where I need to show an label.
First page HTML
<select class="mslt_Field slt_major slt_mjr ipt_required" id="slt_mjr" name="slt_mjr">
<option value="">Please Select</optio
<option value="BA in Arts,Culture&Heritage Ma">BAACHM</option>
<option id="bap_Mjr" class="bap_Mjr" value="Bachelor of Arts in Persian">BAP</option>
<option value="Bachelor of Bus Adminstration">BBA</option>
</select>
Currently I am trying In First Page this is my jquery code
$("#slt_mjr").change(function (){
alert($(this).val());
var dropselvalue = -1;
if (document.getElementById("bap_Mjr").val())
{
alert("check");
dropselvalue = 1;
}
if(window.sessionStorage) {
sessionStorage.setItem("dropselvalue", dropselvalue);
}
});
Second page
<div class="pay_click">Welcome to second page</div>
Second page jquery code
var dropselvalue = parseInt(sessionStorage.getItem("dropselvalue"));
if (dropselvalue != -1) {
if (dropselvalue === 1) {
$(".pay_click").show()
}
//localStorage.removeItem("CheckedRadioValue");
}
The session was not stored and I am not able to get the item.
Where I am doing mistake kindly help me
Thanks in advance