Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote class="spoiler"> <p> Remove "<code>:</code>" before "<code>input</code>"... will be better but didn't do the trick!</p> </blockquote> <p>See <a href="http://api.jquery.com/category/selectors/" rel="nofollow noreferrer">Jquery selectors</a> doc for more informations</p> <p>And you make some mistakes. I thing this one should be correct now : </p> <pre><code>var count = $("li &gt; input.txtdate[value='']+ input.txthrs[value='']").length; </code></pre> <p>You want to retrieve only the number of <code>li</code> where both of <code>txtdate</code> and <code>txthrs</code> are empty?</p> <p>You can see it in action <a href="http://jsfiddle.net/Ab7Tf/1/" rel="nofollow noreferrer">in this updated palash fiddle</a></p> <p>To complete, in the case that empty <code>value</code> are in fact when <code>value</code> attrib missing, use this one : </p> <pre><code>var count = $("li &gt; input.txtdate:not([value])+ input.txthrs:not([value])").length; </code></pre> <blockquote class="spoiler"> <p> To be sure to have value attrib : $('input[type=text']:not([value])).attr('value','');</p> </blockquote> <p>To retrieve the number of line with almost one of field empty, use this : </p> <pre><code>var count = $.unique($("li").has("input.txtdate[value=],input.txtdate:not([value]),input.txthrs[value=],input.txthrs:not([value])")).length; </code></pre> <p>Update</p> <pre><code>$('input:not([value])').attr('value', ''); //Getting only lines when one of input is empty $.unique($("li").has("input.txtdate[value=''],input.txthrs[value='']")).length; //Getting only lines when both inputs are empty $("li &gt; input.txtdate[value='']+input.txthrs[value='']").length; </code></pre> <p>Trust me, or not...</p> <p>UPDATE with new DOM input aren't direct child of li</p> <pre><code>$('input:not([value])').attr('value', ''); //Getting only lines when one of input is empty $.unique($("li").has("input.txtdate[value=''],input.txthrs[value='']")).length; //Getting only lines when both inputs are empty $("li input.txtdate[value='']+input.txthrs[value='']").length; </code></pre> <p>I wake up... sorry! So you was right form the beginning, with simple selector, you can't detect a user update of a input! Sorry I was wrong! I founded this plugin <a href="https://stackoverflow.com/questions/5060652/jquery-selector-for-input-value">here</a> : </p> <pre><code>jQuery.extend( jQuery.expr[':'], { /// check that a field's value property has a particular value 'field-value': function (el, indx, args) { var a, v = $(el).val(); if ( (a = args[3]) ) { switch ( a.charAt(0) ) { /// begins with case '^': return v.substring(0,a.length-1) == a.substring(1,a.length); break; /// ends with case '$': return v.substr(v.length-a.length-1,v.length) == a.substring(1,a.length); break; /// contains case '*': return v.indexOf(a.substring(1,a.length)) != -1; break; /// equals case '=': return v == a.substring(1,a.length); break; /// not equals case '!': return v != a.substring(1,a.length); break; /// equals default: return v == a; break; } } else { return !!v; } } } ); </code></pre> <p>Wich allow you to make some selecotr like this : </p> <pre><code>$('input:field-value(=)');//for empty $.unique($("li").has("input.txtdate:field-value(=),input.txthrs:field-value(=)")).length; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload