javascript - Returns true if it is a vowel, false otherwise -
below code finding out if character vowel or not. when run it, doesn't print out true or false.
can please me see doing wrong?
var vowel = function(str) { var matches = str.match(/[aeiou]/gi); var count = matches ? matches.length : 0; document.getelementbyid('p').innerhtml = "'" + str + "contains" + count + "vowel(s)"; return false; } vowel(str);
<form> <input type="text" name='t1'> <input type='submit' value="submit" onclick='return vowel(this.form.t1.v'> <div id="p"></div> </form>
instead of document.getelementbyid
try document.getelementbyid
Comments
Post a Comment