Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery input selector with li
    text
    copied!<p>I have list of input textbox with class="txtdate"</p> <p>and</p> <p>list of another input textbox with class ="txthrs"</p> <p>like</p> <pre><code> &lt;div id="dvlitr"&gt;&lt;li id="0"&gt;&lt;label class="txtdatewrapper"&gt;&lt;input type="text" placeholder="Select Date" class="txtdate hasDatepicker" value="" readonly="" id="txtsDate1"&gt;&lt;span class="txtdateicon"&gt;&lt;/span&gt; &lt;/label&gt;&lt;input type="text" placeholder="Hrs" class="txthours" value="" id="txtsHrs1"&gt;&lt;a title="Add" class="btnadd" href="javascript:void(0)"&gt;&lt;/a&gt;&lt;a title="Delete" id="btndelnewli1" class="btndelete" href="javascript:void(0)"&gt;&lt;/a&gt;&lt;input type="hidden" placeholder="Hrs" value="0" id="iDhdn0"&gt;&lt;/li&gt;&lt;li id="2"&gt;&lt;label class="txtdatewrapper"&gt;&lt;input type="text" placeholder="Select Date" class="txtdate hasDatepicker" readonly="" id="txtsDate2" value="10/28/2013"&gt;&lt;span class="txtdateicon"&gt;&lt;/span&gt;&lt;/label&gt; &lt;input type="text" placeholder="Hrs" class="txthours" id="txtsHrs2"&gt;&lt;a title="Add" class="btnadd" href="javascript:void(0)"&gt;&lt;/a&gt;&lt;a title="Delete" id="btndelnewli2" class="btndelete" href="javascript:void(0)"&gt;&lt;/a&gt;&lt;input type="hidden" placeholder="Hrs" value="0" id="iDhdn2"&gt;&lt;/li&gt;&lt;li id="3"&gt;&lt;label class="txtdatewrapper"&gt;&lt;input type="text" placeholder="Select Date" class="txtdate hasDatepicker" readonly="" id="txtsDate3" value="10/30/2013"&gt;&lt;span class="txtdateicon"&gt;&lt;/span&gt;&lt;/label&gt; &lt;input type="text" placeholder="Hrs" class="txthours" id="txtsHrs3"&gt;&lt;a title="Add" class="btnadd" href="javascript:void(0)"&gt;&lt;/a&gt;&lt;a title="Delete" id="btndelnewli3" class="btndelete" href="javascript:void(0)"&gt;&lt;/a&gt;&lt;input type="hidden" placeholder="Hrs" value="0" id="iDhdn3"&gt;&lt;/li&gt;&lt;/div&gt; </code></pre> <p>I have to find is there any li with empty date or empty hrs (any one of them)</p> <p>i tried something like this</p> <pre><code> var count = $('#dvlitr &gt; li').filter(function() { var $txtdate = $(this).children('.txtdate').val(); var $txthrs = $(this).children('.txthrs').val(); return (($.trim($txtdate) != '' &amp;&amp; $.trim($txthrs) === '') || ($.trim($txtdate) === '' &amp;&amp; $.trim($txthrs) != '')) }).length; alert(count); </code></pre> <p><a href="http://jsfiddle.net/mparvez1986/6Wf2f/" rel="nofollow">fiddle</a></p> <p>but dint get the desired result</p> <p>please help</p> <p>Thanks </p>
 

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