dynamic html elements in erb file

Hi, I have a huge table in database and need to fill the values using web forms. Some fields are repeatable so my form can have a link to provide same form many times. I can acheive this by using java script but how to get id of elements added dynamically. For example if I add one <div> containing 1 text box 1 combobox, how to get ids so that I can use them in my erb file.