This is for help with a website I am building for class
assignment so far
Trying to make a function to compare input text to match certain words that I choose. So for this example if the user inputs anything other than bark
or Bark
in the text area it should just tell you in console it is incorrect. I plan on using this for a bigger function that passes a true/false that validates the name, date,phone, etc... but now I'm just trying to get this simple code to run in jsfiddle without a "this is not a function" in the console.
HTML
<form name="inputForm" onsubmit="verify() " enctype="text/plain">
<input id="verify" type="text" name=verify placeholder="Dog talk and tree clothes?" required="required"/>
<input type="submit" name="submit" value="submit" />
</form>
Javascript
var val = document.getElementById('verify').value;
function verify(val){
if(val === 'bark' || val === 'Bark'){
console.log("yes");
} else {
console.log("no");
}}