Thank for this,
i tried this:
$$('#nav ul.level0').invoke('remove');
and
$$('ul.level0').invoke('remove');
but both are doing nothing.
Maybe its better i explain what i want to do:
I have a Magento Shop with a large Subkategorie Navigation.
In some cases i dont need to display this subkategorie Nav. so i set
this to display:none with css.
But the Code is still in the Markup and the Searchengines will
sometimes crawl this.
So the goal is to remove this Navigation kompletly if it is not
required.
Is this script the right way to do this?
Thanks a lot
On 24 Apr., 16:16, Walter Lee Davis <[email protected]> wrote:
> HTML className is not spec'd to be page-unique, so there is no such
> concept as "get the one element with this className". The DOM function
> is document.getElements.ByClassName (note the plural), and returns an
> array -- even if there's just one such on the page. Likewise the
> Prototype double-dollar always returns an array, maybe even an empty
> array.
>
> So you have to use one of the Iterator functions to apply the desired
> transformation to each element of the array. In your case, I would use
> invoke, since it's very fast.
>
> $$('.some_class').invoke('remove');
>
> Walter
>
> On Apr 24, 2009, at 8:30 AM, [email protected] wrote:
>
>
>
> > Hello,
>
> > i need a function witch removes an selector and his elements inside.
> > It works well with id like this:
> > $('mutsu').remove();
>
> > but it wont work with class name.
> > I tried:
>
> > $$('.className').remove();
> > and
> > document.getElementByClassName('className').remove();
>
> > It return always:
> > $('.className') has no properties
>
> > Do anyone know how i select a selector with a class?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---