Jquery 中attribute 選取器中屬性"value"說明

來源:互聯網
上載者:User

標籤:style   使用   sp   for   問題   bs   line   tt   nbsp   

            在jquery 1.8使用 $(‘#form input[name=‘name‘][value!=‘‘]‘)進行帥選 表單中不為空白的時候 可以使用,但是使用10 後者 11以上的版本就有問題了

        <form id="form">

            <input type="text" name="name" value="1">--------1

            <input type="text" name="name" value="1">--------2

            <input type="text" name="name" value="">----------3

            <input type="text" name="name" value="">----------4

            <input type="text" name="name" >----------5

        </form>

在10 以上的版本中 使用$(‘#form input[name=‘name‘][value!=‘‘]‘).length  值會=3  其中預設value的第5個 也會包含進去

選中項 為 1 2 5

但是 如果你在頁面中對 3 4 輸入的話 在使用$(‘#form input[name=‘name‘][value!=‘‘]‘).length 值還是為 3 不會改變 

選中項 也是為 12 5

但是 5 為什麼會被選中呢 這個 還不清楚 

所以這裡有兩個問題 第一 5 在預設 value 為什麼會選中 第二 在對 3 4 輸入 為什麼不會被選中


Jquery 中attribute 選取器中屬性"value"說明

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.