So, it's a special case in not()? Just to clarify: If I use $('[EMAIL PROTECTED]@name=checkbox]') , It should read: select an input element with checkbox type and named 'checkbox'.
But in not('[EMAIL PROTECTED]@name=checkbox]') , It should read: select input element OR element with checkbox type OR element named 'checkbox'. Is that right? On 10/4/06, John Resig <[EMAIL PROTECTED]> wrote: > .not() is really greedy, if filters out /everything/ that you specify, > so when you say: > > [EMAIL PROTECTED]@name=checkbox] > > You're saying: > - Anything that's not an input element > - AND anything that's type property isn't checkbox > - AND anything that's name isn't checkbox > > It's the first one that's goofing you up, in the end you can probably > just reduce it to: > > .not("[EMAIL PROTECTED]") > > Hope this helps! > > --John > > On 10/4/06, Jacky <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > I'm a newbie in jQuery. I have some question on how 'not()' works. e.g. > > > > HTML: > > <table id="test"> > > <tr> > > <td> > > <input type="checkbox" name="checkbox"/> > > <input type="hidden" name="hidden"/> > > </td> > > <td> > > <input type="text" name="text"/> > > </td> > > <td> > > <select name="select" name="select"> > > <option value="0">0</option> > > </select> > > </td> > > <td> > > <textarea rows="3" cols="11" > > name="textarea"></textarea> > > </td> > > </tr> > > </table> > > > > > > JS: > > $(document).ready(function(){ > > $("#test") > > .find("tr").find("input,select,textarea") > > .not("[EMAIL PROTECTED]@name=checkbox]") > > .each(function(){ > > alert(this.name); > > }); > > }); > > > > What I thought was that it should find all the input,select,textara in > > <tr> ,remove all checkbox elements and alert their names. So I'm > > expecting 'hidden','text','select' and 'textarea' would be alerted. > > > > But in reality, it will only alert 'select' and 'textarea'. Why is that?? > > > > -- > > Best Regards, > > Jacky > > http://jacky.seezone.net > > > > _______________________________________________ > > jQuery mailing list > > discuss@jquery.com > > http://jquery.com/discuss/ > > > > > -- > John Resig > http://ejohn.org/ > [EMAIL PROTECTED] > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > -- Best Regards, Jacky 網絡暴民 http://jacky.seezone.net _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/