Re: [jQuery] question on how not() works
Thank you for your help~~ And yes, I'm going to match a set of checkboxes with same id prefix. (some multiple editable row control) On 10/5/06, John Resig [EMAIL PROTECTED] wrote: I tried to assign an id 'checkbox' to the checkbox in the example. Using not('[EMAIL PROTECTED]') result in js error in firefox: 'z has no properties' points to line 710 of jQuery.js (Rev: 249) Also, just using = should be sufficient. If you're trying to match a set of checkboxs, you should go against the @type attribute, or its classname, instead. --John ___ 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/
Re: [jQuery] question on how not() works
.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=00/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/
Re: [jQuery] question on how not() works
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=00/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/
Re: [jQuery] question on how not() works
I tried to assign an id 'checkbox' to the checkbox in the example. Using not('[EMAIL PROTECTED]') result in js error in firefox: 'z has no properties' points to line 710 of jQuery.js (Rev: 249) On 10/4/06, John Resig [EMAIL PROTECTED] wrote: 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? .not() is the inverse of .filter() .filter([EMAIL PROTECTED]@name=checkbox]') would be: Is an input element AND is a checkbox AND is named checkbox whereas .not([EMAIL PROTECTED]@name=checkbox]') is: Is NOT an input element AND is NOT a checkbox AND is NOT named checkbox I guess it's not the true inverse, but you get the idea. --John ___ 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/
Re: [jQuery] question on how not() works
I tried to assign an id 'checkbox' to the checkbox in the example. Using not('[EMAIL PROTECTED]') result in js error in firefox: 'z has no properties' points to line 710 of jQuery.js (Rev: 249) Also, just using = should be sufficient. If you're trying to match a set of checkboxs, you should go against the @type attribute, or its classname, instead. --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/