简体   繁体   中英

Rails 3 - How to set different id (html attribute) in nested form attributes

I'm developing a rails 3.0.9 app, I'm using "accept nested attributes for" to add dynamically new "child" items to its "parentW. the thing is every child has the same id (html attribute), and I need every child with its own id, because I need to make some jquery functions to work with them.

Is there a way to achieve this?

Tanks for your help

Adding an new element to a Nested Form was handled brilliantly in a Railscast . In it, Ryan uses javascript to replace the ID attribute with something more meaningful.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM