I am trying to verify if a user enters an exact string, but I'm running into issues. I have attempted some of the recommendations in similar questions, but I am still unable to resolve it.
function check() {
var correctAnswer ="Hey there";
var userAnswer = document.getElementById("#ans").value;
if (correctAnswer == userAnswer) {
alert('Yes, that is correct');
} else {
alert('No, try again');
}
}
HTML
<form>
<fieldset>
<input type="text" name="Textbox" value="" id="ans"><br>
<input type="submit" value="Submit" id="test" onClick=" return check()">
</fieldset>
</form>