开发者

Ruby on rails complex dynamic forms

I have implemented rails complex form from Railscasts tutorial in my Rails app. I want to add ajax inside the complex form, where in I have implemented a prefill functionality ins开发者_如何学编程ide the complex form. But I need to know the unique id of the div the complex form generates automatically.

<div class="inputs">
  <span class="input_wrapper">
    <input class="text" id="formname_attributes_0_example" name="formname[attributes]  [0][example]" size="30" type="text" />
  </span>
  <button  type="button" onclick="dinfill(this);" >Pre-fill</button>      
</div>
<div class="inputs">
  <span class="input_wrapper">
   <input class="text" id="formname_attributes_1_example" name="formname[attributes]  [1][example]" size="30" type="text" />
  </span>
  <button  type="button" onclick="dinfill(this);" >Pre-fill</button>          
</div>

How do I fetch id="formname_attributes_1_example" the unique id '1' or any id from the above code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜