Thanks Klaus and Wizzud I really don't know what the problem is. Here is the latest thing I tried.
// $ ("#app_content_2356318").children('div').children('table').filter(function(index) { return false; }) ; // does not works with or without the index as parameter. Nothing is removed $ ("#app_content_2356318").children('div').children('table').remove() ; // works! The table is removed. Really simple but I must be missing something crucial. Some background: I am using Greasemonkey and Firebug. I am not using the $(document).ready(function() { because it does not seem to work with Greasemonkey. Pluthos On Sep 10, 2:56 am, Wizzud <[EMAIL PROTECTED]> wrote: > Yes, I must admit I did not test the actual documented example - I was > heading more at the root of the problem, ie what wasn't working with > Pluthos' script that caused him to try the example in the first place! > > > > Klaus Hartl wrote: > > > Pluthos wrote: > >> Hi everyone, > > >> I am new to this group. I have been trying to get filter(function) to > >> work for a few days without success. My goal was to remove DOM > >> elements that did not belong to a pre-arranged array. Out of > >> desperation I tried the example given in the on line documentation at > >>http://docs.jquery.com/Traversing/filter#fn. The example is: > > >> $("p").filter(function(index) { > >> return $("ol", this).length == 0; > >> }); > > >> with the corresponding HTML code: > > >> <p><ol><li>Hello</li></ol></p><p>How are you?</p> > > >> THIS DID NOT WORK! > > >> Is it a bug in jQuery or am I doing something wrong? Could one of you > >> try this same example? Thank you. > > >> Pluthos > > > This is because a <p> element cannot contain a <ol> element and the > > filter like any other related selector simply does not match, because > > the browser's tag soup parser closes the <p> element before the <ol> > > starts. > > > As of lately this problem was discussed pretty often, see the following > > thread: > >http://groups.google.com/group/jquery-en/browse_thread/thread/e8790c0... > > > And the problem explained in more detail: > >http://groups.google.com/group/jquery-en/browse_thread/thread/50fa1b3... > > > --Klaus > > -- > View this message in > context:http://www.nabble.com/filter%28fn%29-tf4411567s15494.html#a12589785 > Sent from the JQuery mailing list archive at Nabble.com.