I'm working on a javascript exercise to create a guessing game. I'm doing a bit of testing of the function before moving onto the next stage but this isn't working. When you click the button it's not giving the pop-up "Right Answer!". Any ideas?
<html>
<head>
<script>
var userguess = "5";
var answer = "5";
function Guess(){
if (userguess==answer){
alert("right answer!");
} else {
alert("wrong answer!");
}
}
</script>
</head>
<body>
<form>
<input id="Guess" type="text" />
<button name="button" onClick="Guess()">Click me</button>
</form>
</body>
</html>
onclickuse lowercase C<button type="button"> to alleviate this (or use the side effect in Developer's answer).