How to insert conditional in a rjs file

Whenever you want to do something with an element that may not be
present on the page using the select method makes a lot of sense. It
builds a collection of all the elements that can be described by some
css select (hence id's or css classes) and then you can use something
like .each to iterate through the collection. Something like:

page.select('#current_item').each{|elem|
elem.visual_effect :highlight, :startcolor => "#88ff88", :endcolor =>
"#114411"