Javascript in rjs?

Hi, I’m trying to see if an element exists in my rjs:

exists = document.getElementById(“checkX”)

Something to that extent… how do I add that into the rjs?


page << “exists = document.getElementById(“checkX”)”

Or u can do like

page << “if($(‘checkX’)){”
Do what u need here
page << “}”

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