How to count text fields that are not empty with JQuery?
Here's how I thought:
var cnt = 0;
$.each($("input[name=items]"), function(i){
if($(this).val() != ""){
cnt++;
}
});
If I use this codes, I have to write each function unconditionally. This is a waste of somehow, but is there any other way? Or is this the best way?