2014-03-04 28 views
5

選擇第三對象輸入類列表我有我的HTML,因爲這選擇類,然後在jQuery的

<div class="content"> 

    <section class="abc"> 
    <input type="text"/> 
    <input type="text"/> 
     ... 
    <input type="text"/> 

    </section> 
    <section class="abc">...</section> 
    <section class="abc">...</section> 
    <section class="abc">...</section> 
    <section class="abc">...</section> 
    <section class="abc">...</section> 

</div> 

從上面的代碼,我需要選擇按編號每個部分(如第0,1)所有輸入有空值

如何寫jQuery的選擇呢?

+0

你有沒有嘗試任何代碼?如果是的話請先發帖。 – Amit

+0

'$('input [value =「」]')'? –

+0

我試過這個var emptyTextBoxes = $(「.abc(0)>」+'input:text [value =「」]')。 – bpbhat77

回答

3

嘗試,

$('.content .abc:nth-child(1) input:visible').filter(function(){ return $.trim(this.value) === ''; }); 

我只是給2n用於示範的目的,因爲你的問題還不清楚,但是你可以根據你的需要幀。

+2

@ bpbhat77:請不要通過詢問你的問題來引導回答者,這會導致一個笨拙的評論主題,並浪費每個人的時間。提前陳述您的所有要求,並通過編輯列出您的問題。 – BoltClock