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
-~----------~----~----~----~------~----~------~--~---