say for example i had something simple like this in a view: <tr class="even"><td><%= check_box_tag(:task) %></td> how would i add onclick to change the row color on a check and when the check is removed? maybe something like this? page[task].addClassName(''complete'') i''m not that familiar with javascript so i''m not sure how i would finish this. thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Scott Kulik wrote:> say for example i had something simple like this in a view: > > <tr class="even"><td><%= check_box_tag(:task) %></td> > > how would i add onclick to change the row color on a check and when the > check is removed? > > maybe something like this? > > page[task].addClassName(''complete'') > > i''m not that familiar with javascript so i''m not sure how i would finish > this. thanks!<%= check_box_tag :task, 1, false, :onchange => "$(parentNode.parentNode).toggleClassName(''complete'')" %> -- Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mark Reginald James wrote:> Scott Kulik wrote: >> >> i''m not that familiar with javascript so i''m not sure how i would finish >> this. thanks! > > <%= check_box_tag :task, 1, false, > :onchange => "$(parentNode.parentNode).toggleClassName(''complete'')" %> > > -- > Rails Wheels - Find Plugins, List & Sell Plugins - > http://railswheels.comperfect! thank you so much mark! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Scott Kulik wrote:> Mark Reginald James wrote: >> Scott Kulik wrote: >>> >>> i''m not that familiar with javascript so i''m not sure how i would finish >>> this. thanks! >> >> <%= check_box_tag :task, 1, false, >> :onchange => "$(parentNode.parentNode).toggleClassName(''complete'')" %> >> >> -- >> Rails Wheels - Find Plugins, List & Sell Plugins - >> http://railswheels.com > > perfect! thank you so much mark!oops spoke a little too soon. the highlighting works great on firefox 3 but for some reason it acts a little weird on IE7. the first check box i click doesn''t do anything but then if i click another check box the first check box row gets highlighted. any idea what could be causing the incompatibility with IE? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mon, Dec 29, 2008 at 11:17 PM, Scott Kulik <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Scott Kulik wrote: >> Mark Reginald James wrote: >>> Scott Kulik wrote: >>>> >>>> i''m not that familiar with javascript so i''m not sure how i would finish >>>> this. thanks! >>> >>> <%= check_box_tag :task, 1, false, >>> :onchange => "$(parentNode.parentNode).toggleClassName(''complete'')" %> >>> >>> -- >>> Rails Wheels - Find Plugins, List & Sell Plugins - >>> http://railswheels.com >> >> perfect! thank you so much mark! > > oops spoke a little too soon. the highlighting works great on firefox 3 > but for some reason it acts a little weird on IE7. > > the first check box i click doesn''t do anything but then if i click > another check box the first check box row gets highlighted. > > any idea what could be causing the incompatibility with IE?Try adding `this`: <%= check_box_tag :task, 1, false, :onchange => "$(this.parentNode.parentNode).toggleClassName(''complete'')" %> -- -------------------------------------------------------------------------------- Training by Collective Idea: Ruby on Rails training in a vacation setting http://training.collectiveidea.com – San Antonio, TX – Jan 20-23 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Brandon Keepers wrote:> On Mon, Dec 29, 2008 at 11:17 PM, Scott Kulik > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >>>> >> another check box the first check box row gets highlighted. >> >> any idea what could be causing the incompatibility with IE? > > Try adding `this`: > > <%= check_box_tag :task, 1, false, > :onchange => > "$(this.parentNode.parentNode).toggleClassName(''complete'')" %> > > -- > -------------------------------------------------------------------------------- > Training by Collective Idea: Ruby on Rails training in a vacation > setting > http://training.collectiveidea.com � San Antonio, TX � Jan 20-23same thing :( i found some info here: http://dev.rubyonrails.org/ticket/11078 and the link they reference http://prototypejs.org/learn/extensions...there is a bit at the bottom: // this will error out in IE: $(''someElement'').parentNode.hide() // to make it cross-browser: $($(''someElement'').parentNode).hide() so....i tried these ways: $(this.parentNode.parentNode).toggleClassName(''complete'') $($(this).parentNode.parentNode).toggleClassName(''complete'') $($(''make_step18'').parentNode.parentNode).toggleClassName(''complete'') make_step18 is the id of checkbox i was testing. but they all produce the same weird result where they don''t update until i click a second time. first click always does nothing. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Scott Kulik wrote:> > but they all produce the same weird result where they don''t update until > i click a second time. first click always does nothing.finally got it. it was the :onchange that was causing some issues. i changed it to :onclick and all methods are now working with IE7. thanks again everyone! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---