Ajax .rjs replacing an element class

I know how to replace an inner html element , using

page.replace_html ‘myElement’, :partial => ‘myPartial’

How to change the class value of an html element in my .rjs file
using a prototype.js function

removeClassName(‘myElment’, ‘anOldClassName’)
or
addClassName(‘myElement’, ‘aNewClassName’)

thanks fyh

kad

Kad K. wrote:

I know how to replace an inner html element , using

page.replace_html ‘myElement’, :partial => ‘myPartial’

How to change the class value of an html element in my .rjs file
using a prototype.js function

removeClassName(‘myElment’, ‘anOldClassName’)
or
addClassName(‘myElement’, ‘aNewClassName’)

thanks fyh

kad

reply to myself (may help future searches…)

page[‘myElement’].removeClassName(‘anOldClassName’)
page[‘myElement’].addClassName(‘aNewClassName’)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs