In a dynamically generated set of file upload controls:
<input type="file" name="archivos[]">
<input type="file" name="archivos[]">
<input type="file" name="archivos[]">
// ...
... I can easily count the non-empty ones:
// Works fine
var nonEmptyCount = $("input[type='file'][name='archivos[]'][value!='']").length;
However, when I try to count the empty ones (what I actually need) the selector never matches anything:
// Always zero
var emptyCount = $("input[type='file'][name='archivos[]'][value='']").length;
I can't believe I need this cumbersome code:
// Works but ugly
var emptyCount = $("input[type='file'][name='archivos[]']").length -
$("input[type='file'][name='archivos[]'][value!='']").length;
What bit am I missing?