I am currently working on a local repository, where on the first page I have two radio buttons, if the user selects the first switch in the second page panel to hide. And if the user selects the radio button, one text field from checking the second page should not occur, I have no idea how to use localStorage or ajax, which will be the best
When I saw SO, I got something window.localStorage.setItem("key_name", "stringValue");
Please advise me how to use it:
First page code
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<meta charset="utf-8">
<title>First page</title>
</head>
<body>
<form id="first_pge" class="first_pge" action="second.page">
<input type="radio" name="radio" id="first_radio"/>
<input type="radio" name="radio" id="second_radio"/>
<input type="button" value="submit" id="btn_sub"/>
</form
</body>
</html>
Second page
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.14.0/jquery.validate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.14.0/additional-methods.min.js"></script>
<script>
jQuery.validator.setDefaults({
debug: true,
success: "valid"
});
$("#myform").validate({
rules: {
field: {
required: true
}
}
});
</script>
<meta charset="utf-8">
<title>JS Bin</title>
<style>
.div_panel {
background-color: yellow;
font-size: 16px;
}
</style>
</head>
<body>
<form id="myform" class="myform">
<div class="div_panel">First</div>
<div> </div>
<input type="text" id="field" class="field" />
<input type="button" required value="Submit" id="btn_sub1" />
</form>
</body>
</html>
Currently, working with jquery according to the user below helps me.
on the first page that I set as follows
storeData();
function storeData()
{
alert("check");
localStorage.setItem('pg', $('#basicForm #pg').attr('checked', 'checked'));
localStorage.setItem('cu', $('#basicForm #cu').attr('checked', 'checked'));
}
, div , : (
,
if( localStorage.getItem('pg') )
{
$('#edu_info').hide();
}