Q:

Return number of non-empty inputs in a table

Is there a way I can return the number of non-empty inputs in a table?
So far I have tried:
$("#template_item_table").find('input:number[value=""]').length 
but it keeps giving me
Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: number(…).
Here's my input:
<input type="number" class="form-control quantity" name="quantity" min="1">
Can someone help?

A:

Try to use .filter at this context
var len = $("#template_item_table").find('input[type=number]').filter(function(){
  return this.value.trim().length > 0;
}).length;

console.log(len + "non empty number text boxes are there!!");

to filter out the non empty number text boxes inside your table #template_item_table

