Hi,
> but it wont work with class name.
Well, let's think about what you're doing. You're using $$(), and
then calling a remove() method on what it returns. According to the $$
() docs[1], it returns an array. So unless arrays have a remove()
method (I don't think they do), that's not going to work.
Fortunately, though, Prototype provides this nifty invoke()[2] method
on Enumerable[3], which it mixes in with arrays. invoke() will call a
given function on each element in the array. So putting these things
together:
$$('.myclass').invoke('remove');
[1] http://prototypejs.org/api/utility/dollar-dollar
[2] http://prototypejs.org/api/enumerable/invoke
[3] http://prototypejs.org/api/enumerable
HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available
On Apr 24, 1:30 pm, "[email protected]"
<[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?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---