Right, so that explains all. Nobody paid any attention to the "nested in certain DIVs" part, including me:
$('input').filter(function(){ return !$(this).parent().is('#addNewAdress,#addNewContactDetail'); }).click(function(){ console.log(this.id); }); read on about the filter function at http://docs.jquery.com/Traversing, and make sure you post the full code next time :) cheers, - ricardo On Dec 16, 4:18 pm, WhoButSB <whobu...@gmail.com> wrote: > Thanks Ricardo after lunch I will give that a try. No the Id is not > the input itself it a actually the parent div and there are a > collection of inputs in the div. I would post my HTML but there is so > much php looping and conditions that it would just Mqke this thread > more confusing. > > On Dec 16, 1:04 pm, Ricardo Tomasi <ricardob...@gmail.com> wrote: > > > by the way: Is #addNewAdress the input itself? Maybe what you're > > looking for is #addNewAdress :input. Again, seeing the relevant HTML > > would help. > > > On Dec 16, 1:26 pm, WhoButSB <whobu...@gmail.com> wrote: > > > > I gave this a try: > > > $("input:not(#addNewAddress:input, #addNewContactDetail:input)").focus > > > (); > > > > And the function would still run :-/ . Maybe I should use the input > > > selector then add a class to the ones i don't want to grab and use the > > > hasClass method to return a false for the ones not supposed to > > > activate. > > > > But I have to believe there is an easier way. > > > > On Dec 15, 7:39 pm, Kean <shenan...@gmail.com> wrote: > > > > > This probably will work too. > > > > > $("input:not(#addNewAddress, #addNewContactDetail)").click(); > > > > > On Dec 15, 3:01 pm, "Rik Lomas" <lomas....@gmail.com> wrote: > > > > > > Try: > > > > > > $("input").not('#addNewAddress, #addNewContactDetail').click(); > > > > > > Rik > > > > > > 2008/12/15 WhoButSB <whobu...@gmail.com>: > > > > > > > Hello All! > > > > > > I'm trying to figure out the correct way to use the not() method. I > > > > > > know there is also a :not() filter in selectors class but I couldn't > > > > > > get that one to work either. > > > > > > > My goal is to add a click function to all the input fields on a > > > > > > page. > > > > > > But not select the input buttons that are nested in certain divs. > > > > > > > Here is what I have tried so far: > > > > > > > $("input").not($('#addNewAddress:input', > > > > > > '#addNewContactDetail:input')).click(function(){ > > > > > > console.log($(this).attr('id')); > > > > > > }); > > > > > > > AND > > > > > > > $("input").not('#addNewAddress input', '#addNewContactDetail > > > > > > input').click(function(){ > > > > > > console.log($(this).attr('id')); > > > > > > }); > > > > > > > Neither have worked so far. Should I be using the :not() command in > > > > > > the selector? > > > > > > > Thanks for the help! > > > > > > -- > > > > > Rik Lomashttp://rikrikrik.com