简体   繁体   中英

How to select unchecked checkbox

I am using jquery UI tabs. I have 2 tabs with id #tab1 & #tab2 respectively. Both tab

contains 2 checkbox (total 4) . And currently all are unchecked . Now i wrote this jquery code :

  $("#tab2").find("input:not(:checked)").each(function () { alert("1"); });

My problem is that, the alert come 4 times , but it should come 2 times . Whats the problem here?

EDIT

       <div class="dialog">
            <div id="tab">
                <ul>
                    <li><a href="#tab1">A</a></li>
                    <li><a href="#tab2">B</a></li>
                </ul>
                <div id="tab1">
                        <input type="checkbox" />
                        <input type="checkbox" />
                </div>
                <div id="tab2">
                        <input type="checkbox" />
                        <input type="checkbox" />
                </div>
            </div>
        </div>

check this fiddle . it is working fine for me..

http://jsfiddle.net/kabichill/6XmYn/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM