In my MVC application i have a view in which i refresh the page each 10 seconds. I have some paragraph in the view are hidden and a button which make those paragraphs not hidden. The problem that when i click on the button to make the paragraph show when the page reload automatically in 10 seconds returns the paragraph hidden.
This is the button:
<button id="button">Display Internal Sequences</button>
This is the paragraph :
<p1 hidden style="text-align:center;font-size: 50px; padding:-25px; margin:-25px;">@Html.Label(@Model.CSLine.ModuleOrderInternalSequence > long.MinValue ? @Model.CSLine.ModuleOrderInternalSequence.ToString() : string.Empty)</p1>
This is the script to make the p not hidden:
<script>
$(document).ready(function () {
$("#button").click(function () {
$("p1").attr("hidden", false);
var show ='true';
localStorage.setItem(key, show);
});
});
</script>
This is the reload each 10 seconds:
setTimeout(function () {
window.location.reload(1);
}, 10000);
$(document).ready(function() {
var show = localStorage.getItem(key);
if (show == 'true')
{
$("p1").attr("hidden", false);
} })
The result is that the paragraph returns hidden after each reload. I want when i click the button the paragraph became not hidden even after reload.
Thank you