Created
July 13, 2023 16:21
-
-
Save yashasvi9199/93f774f12848b54060bf33d2f9a311f7 to your computer and use it in GitHub Desktop.
Check if the function has already been executed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script> | |
</head> | |
<body> | |
<button id="first">Click Me Once!</button> | |
<script> | |
$("button").click(function() { | |
if (!localStorage.getItem("validate")) { | |
alert("Thanks for clicking me !"); | |
localStorage.setItem("validate", "true"); | |
} else { | |
alert("You can't do that again!!"); | |
} | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment