Reputation: 6981
I've got this response in my Chrome console for a view:
$('.checklist-17012').length
5
There are five in the view, so that's correct. The problem is that they're all empty, and no matter what I do I can't count the empty ones:
$('.checklist-17012[val=""]').length
0
$('.pdf-checklist-17012[val=null]').length
0
Here's the HTML:
<input type="text" name="30954" id="30954" value="" class="checklist-17012 form-control">
What am I doing wrong?
Upvotes: 3
Views: 40
Reputation: 121998
There is no attribute called val
. Should be value
$('.checklist-17012[value=""]').length
console.log($('.checklist-17012[value=""]').length)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" name="30954" id="30954" value="" class="checklist-17012 form-control">
Upvotes: 4