I have requirement where if I click on a checkbox the value gets submitted and hence the page gets reloaded. Now, to click another checkbox, i need to scroll down again which is not a better idea. So, now I want to retain my scrollbar position even after page gets reloaded. Is there any method in javascript to do that? I have tried the below code, but there was no luck.
<input type="checkbox" onclick="myFunction()"/> One <br/>
function myFunction() {
document.body.scrollTop = 500px;
}
I also browsed many websites but nothing worked for me.
Please help me with this issue.
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…