Sigmahokies Posted November 5, 2018 Share Posted November 5, 2018 Hi everyone, I'm trying to create the look like "paginate data page", but it is not. I set up the file to insert in website by iframe, but I need to find a way to make clicked data like click the checkbox, then click on next, go to next file in iframe, then come back, stay checked in checkbox. Do you understand what I mean? I'm not fluent in English, my prime is American Sign Language. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 5, 2018 Share Posted November 5, 2018 If you want to save data across pages on the same domain, you can use sessionStorage for that. Link to comment Share on other sites More sharing options...
Sigmahokies Posted November 5, 2018 Author Share Posted November 5, 2018 Does that mean i have to use PHP as well? Link to comment Share on other sites More sharing options...
dsonesuk Posted November 5, 2018 Share Posted November 5, 2018 A value is set/stored and retrieved using JavaScript https://www.w3schools.com/jsref/prop_win_sessionstorage.asp Link to comment Share on other sites More sharing options...
Sigmahokies Posted November 7, 2018 Author Share Posted November 7, 2018 I used session storage, seem it doesn't work. I use localstorage, seem it works a little, but stayed checked on checkbox has not work. here code I get from other website, but seem function is not right <script> function onClickBox() { let checked = $("#box").is(":checked"); localStorage.setItem("checked", checked); $("#msg").text("Checkbox is checked: " + $("#box").is(":checked")); } function onReady() { $("#msg").text("Loaded."); let checked = "true" === localStorage.getItem("checked"); $("msg").prop('checked', checked); $("#box").click(onClickBox); } $(document).ready(onReady); </script> <form> <div id="msg"></div> <table> <tr><th colspan="3">Spatial Verbs</th></tr> <tr><td>Go/Walk-To/From</td> <td><input class="single-count" type="checkbox" id="box" name="chkboxGrp0[]" value="1"></td> <td class="vert-middle">0</td></tr> Link to comment Share on other sites More sharing options...
justsomeguy Posted November 7, 2018 Share Posted November 7, 2018 You're not using the correct selector to check the box again, you're trying to target a "msg" tag. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now