Check if an HTML element exists in rjs

Does anybody knows how can I check if an HTML element exists via rjs? I’ve been trying, for example:

if page[‘edit_company_’ + @id]

if page[‘edit_company_’ + @id].blank?

But it generates a js code with a .blank? and it doesn’t make any sense in js. I need this to take some actions only if a certain element exists. Any suggestion? Thanks in advance.

Does anybody knows how can I check if an HTML element exists via rjs? I've been trying, for example:

if page['edit_company_' + @id]

if page['edit_company_' + @id].blank?

But it generates a js code with a .blank? and it doesn't make any sense in js. I need this to take some actions only if a certain element exists. Any suggestion? Thanks in advance.

I wrote a bit about this a little while back: http://www.spacevatican.org/2008/5/26/conditional-rjs-explained

Fred