How to get form element id's?

You could just specify the id yourself, rather than trying to
read/replicate the auto-generated one, is that an option? That way you
know for sure what it's going to be called, which will make it easier to
refer to in your JS.

If so then use the :id option and make sure you give it a unique id,
like "post_#{post.id}_name" or something.

Max Williams wrote:

You could just specify the id yourself, rather than trying to
read/replicate the auto-generated one, is that an option? That way you
know for sure what it's going to be called, which will make it easier to
refer to in your JS.

If so then use the :id option and make sure you give it a unique id,
like "post_#{post.id}_name" or something.

That is indeed an option. Thank you very much!