Can someone please help me make a button which prints thank you when clicked? I know there are lots of ways to do this but in my circumstance I need to use an if statement and this has me totally stumped. I have not done much because I am totally unsure on what syntax to use. I have made a website for a school project and it has a form on one of the pages. It is requirement to use javascript to do something with an if statement. I would like to have a button at the bottom of the form which does something to the page when clicked. I don’t really mind what happens but I thought a thank you message would be nice.
Cheers
<!DOCTYPE html>
<html>
<body>
<button id=”sub”>Subscribe</button>
</body>
<script>
function button () {
var message = document.getElementById(“message”);
if (sub.onclicked == true) {
/*Pop up with thank you*/
};
};
button ();
</script>
</html>