How can I check whether an id existed?

How can I check whether an ID existed in the current page? I want to use
the $(‘id’).getValue() to get the field value. But sometimes the ID may
not exist.

if($(‘id’)){
val = $F(‘id’)
}

Sijo Kg wrote:

if($(‘id’)){
val = $F(‘id’)
}

Can I put them in *.html.erb? I got a compile error.

You can put either in your javascript file or enclose in

in the html.erb file

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