Count Vowels
Counts numbers of Vowels in a string
by Uzair Mehmood
HTML
<label for="input">Count vowels in:</label>
<input type="text" id="input" />
<hr>
<p id="output"></p>
JavaScript
$("#input").change(function () {
var word = $(this).val();
var vowels = ["a", "e", "i", "o", "u"];
var vowelCount = 0;
var letters = $(this).val().split("");
$.each(letters, function (i, j) {
if (($.inArray(j.toLowerCase(), vowels)) !== -1) {
vowelCount += 1;
}
});
$("#output").text('Total Vowels Found :' + vowelCount.toString());
});