Skip to content

Instantly share code, notes, and snippets.

@rileyrichter
Created November 27, 2019 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rileyrichter/61b1665998c7d3a0b315fcfeee1c40bd to your computer and use it in GitHub Desktop.
Save rileyrichter/61b1665998c7d3a0b315fcfeee1c40bd to your computer and use it in GitHub Desktop.
<script>
function myVote(shortcode) {
$(document).on('submit', 'form', function() {
// Set product in local storage
localStorage.setItem(shortcode, "true");
// Refresh page after 3000 milliseconds
setTimeout(function() { location.reload(true); }, 3000);
});
};
</script>
<script>
const allthethings = [];
for(let i=0; i<localStorage.length; i++) {
let key = localStorage.key(i);
allthethings.push(localStorage.key(i));
document.getElementById(localStorage.key(i)).style.display = "none";
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment