I have the below HTML DOM
You can pass in a filter function rather than a selector:
$('#container input[type="text"]').filter(function () { return !!this.value; }).length;