I wish to count the number of textboxes that's been filled. I have the following code but it's not working the way I want it too. I'm new to JQuery and the script is based from my research here on Stack Overflow.
Markup:
<input class="a" type="text" name="rep">
<input class="a" type="text" name="rep">
<input class="a" type="text" name="rep">
Script:
$(".a").blur(alert(countRep()));
function countRep() {
var fieldTxtbx = $(".a").filter(function(){
return $.trim($(this).val()) != '';
}).length;
return fieldTxtbx;
}
Why does it work the on load but everytime I input in the textbox the blur() is not called?