For some reason I was sure you were French! hehe :D

In the HTML you posted, everything is inside the #header div.
#menu_lateral_usuario and #footer are not children of #container, they
are way deeper into the DOM
tree. Since everything is contained by #header, it doesn't need to be
excluded. The way to achieve what you want you have to also exclude
all the element's parent's and inner children:

var conteudo = $('#menu_lateral_usuario, #footer');
$("#container *").not(conteudo).not(conteudo.parents()).not
(conteudo.find('*')).empty();

That seems to work with the HTML on pastebin. the page at
barquettenet.net is timing out.

abraço
- ricardo

On Jan 5, 3:53 am, "Dirceu Barquette" <dirceu.barque...@gmail.com>
wrote:
> Hi Ricardo,
>
> Thats right! I know it works. But not with the dirty code of my job, both
> doesn't work...
> You are from Brazil like me. Don't you?
> See the project at:http://calango.barquettenet.net/~dirceu/cva   
> //login:dirceu,
> password:senha
> you can click at "Adicionar projetos". I injected jQuery at this link. My
> goal is bypass the dirty code, but... arghhhh.
>
> using firebug, change the second index of array to "menu_lateral_usuario".
> It seems like this:
>    var a = $('#container')[0];
>    var arr = ["header","menu_lateral_usuario","footer"];
>    jQuery.each(a.childNodes,function(k,v){
>       if (jQuery.inArray(v.id,arr) < 0){
>          $(v).empty();
>       }
>    })
> The above code works (imediatly after login...), but:
> $("#container").children().not("#header, #content, #footer").empty();
> //JResig code
> and
> $("#container > :not(#header, #content, #footer)").empty(); //Kean code
> Both these very clean codes doesn't work... I don't know why, but can help
> me in the future.
>
> You know for my poor english. I really appreciate your help to explain this
> problem. We can chat at gmail if you wish...
>
> Very special thanks to all!
>
> Dirceu Barquette
>
> 2009/1/5 Ricardo Tomasi <ricardob...@gmail.com>
>
>
>
> > Both ways do work, as demonstrated here:
>
> >http://jsbin.com/eruje/
>
> > On Jan 4, 5:53 pm, "Dirceu Barquette" <dirceu.barque...@gmail.com>
> > wrote:
> > > Thanks a lot!
> > > But it doesn't works... :-(
>
> > > I get a really dirty code to add modules. I wish inject a pretty good
> > jQuery
> > > code, but is impossible!!!
>
> > > thanks your attention!
>
> > > Dirceu Barquette
>
> > > 2009/1/4 John Resig <jere...@gmail.com>
>
> > > > Maybe:
> > > > $("#container").children().not("#header, #content, #footer").empty();
>
> > > > --John
>
> > > > On Sun, Jan 4, 2009 at 2:05 PM, Dirceu Barquette
> > > > <dirceu.barque...@gmail.com> wrote:
> > > > > Hi all!
>
> > > > > Is there better way?
>
> > > > > var elem = $('#container')[0];
> > > > > var  arr = ["header","content","footer"];
> > > > > jQuery.each(elem.childNodes,function(k,v) {
> > > > >    if (jQuery.inArray(v.id, arr) < 0) {
> > > > >       $(v).empty();
> > > > >    }
> > > > > })
>
> > > > > thanks
>
> > > > > Dirceu Barquette

Reply via email to