How can I remove all classnames of div using prototype without knowing the classNames? for example: removeClassName(''red'') will remove ''red'' from class="red borderblack other" <- but what if I did not know what the classnames were and wanted to remove all of them so that class would become class="" ? Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Wed, Mar 12, 2008 at 10:13 PM, spilo <spilo101-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > How can I remove all classnames of div using prototype without knowing > the classNames? for example:Just use the className attribute of an element... $(''foo'').className = ''''; There is no way that I can see, with Prototype, to do such a thing, although there is a classNames() method which returns an element''s class names as an Element.ClassNames object. -justin On Wed, Mar 12, 2008 at 10:13 PM, spilo <spilo101-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > How can I remove all classnames of div using prototype without knowing > the classNames? for example: > > removeClassName(''red'') will remove ''red'' from class="red borderblack > other" <- but what if I did not know what the classnames were and > wanted to remove all of them so that class would become class="" ? > > Thanks > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
thorasmund-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Mar-13 06:24 UTC
Re: Removing all classNames of div
On Mar 13, 12:22 pm, "Justin Perkins" <justinperk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Wed, Mar 12, 2008 at 10:13 PM, spilo <spilo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > How can I remove all classnames of div using prototype without knowing > > the classNames? for example: > > Just use the className attribute of an element... > > $(''foo'').className = ''''; > > There is no way that I can see, with Prototype, to do such a thing, > although there is a classNames() method which returns an element''s > class names as an Element.ClassNames object.You could also try $(''foo'').writeAttribute(''class'',''''); cheers, --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Am I missing something here, or would it be easier to write ${''DIV_ID_NAME''}.className=""; ? Cheers, Dave On Thursday 13 March 2008 23:45, ESPNDev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> you''d have to do one pass to find all the classNames using $ > (''DIV_ID_NAME'').classNames().inspect(); and then once you had them in > an array you''d be able to do another pass based on that new array and > remove them with $(''DIV_ID_NAME'').removeClassName(''CLASS_NAME''); one > at a time. > > On Mar 12, 8:13 pm, spilo <spilo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > How can I remove all classnames of div using prototype without knowing > > the classNames? for example: > > > > removeClassName(''red'') will remove ''red'' from class="red borderblack > > other" <- but what if I did not know what the classnames were and > > wanted to remove all of them so that class would become class="" ? > > > > Thanks > >-- Author: Prototype & Scriptaculous in Action, Ajax in Practice, Ajax in Action --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
ESPNDev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Mar-13 23:45 UTC
Re: Removing all classNames of div
you''d have to do one pass to find all the classNames using $ (''DIV_ID_NAME'').classNames().inspect(); and then once you had them in an array you''d be able to do another pass based on that new array and remove them with $(''DIV_ID_NAME'').removeClassName(''CLASS_NAME''); one at a time. On Mar 12, 8:13 pm, spilo <spilo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How can I remove all classnames of div using prototype without knowing > the classNames? for example: > > removeClassName(''red'') will remove ''red'' from class="red borderblack > other" <- but what if I did not know what the classnames were and > wanted to remove all of them so that class would become class="" ? > > Thanks--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I must be getting old, Justin - I''ll up the resolution on my screen in future :) Or should that be :} ?? Dave On Friday 14 March 2008 15:02, Justin Perkins wrote:> On Thu, Mar 13, 2008 at 6:14 PM, Dave Crane <dave-Sy7q136SasSXmMXjJBpWqg@public.gmane.org> wrote: > > Am I missing something here, or would it be easier to write > > > > ${''DIV_ID_NAME''}.className=""; > > You''re missing my first reply :) > > In all seriousness, what''s with the curly braces? > > -justin > >-- Author: Prototype & Scriptaculous in Action, Ajax in Practice, Ajax in Action --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Thu, Mar 13, 2008 at 6:14 PM, Dave Crane <dave-Sy7q136SasSXmMXjJBpWqg@public.gmane.org> wrote:> Am I missing something here, or would it be easier to write > > ${''DIV_ID_NAME''}.className="";You''re missing my first reply :) In all seriousness, what''s with the curly braces? -justin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---