zazu Posted March 21, 2017 Share Posted March 21, 2017 Hey guys i have 2 buttons that i hide and show depending on users click. What i want to do is when a user click first button to rememeber in a cookie that the button is clicked and show the secound button and viceversa. My js code that i;m using right now is posted bellow. How can i do this? Thank you very much! var first = document.getElementById( 'first' ), second = document.getElementById( 'second' ); function toggle() { if ( first.style.display === "block" ) { first.style.display = "none"; second.style.display = "block"; } else { // switch back first.style.display = "block"; second.style.display = "none"; } } first.onclick = toggle; second.onclick = toggle; Quote Link to comment https://forums.phpfreaks.com/topic/303512-remeber-button-click-with-a-cookie-or-localstorage/ Share on other sites More sharing options...
requinix Posted March 21, 2017 Share Posted March 21, 2017 Use Javascript to set (and possibly get) a cookie. Quote Link to comment https://forums.phpfreaks.com/topic/303512-remeber-button-click-with-a-cookie-or-localstorage/#findComment-1544459 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.