有一个 tr,这一行里有三个radio。 
在js里我要用clone语句克隆很多个这个tr,这样的会生成很多个tr,且每个tr里有三个radio但现在问题是第一行的tr中怎么给这三个radio命名才能让clone出来的其他tr中的radio与其他tr中的radio进行区分呢? 因为我clone之后出来的radio的名字都一样,所以很多tr中只能选择一个。如下是代码
<tr>
<th><input type="checkbox">{=_('标题')}</th>
<td colspan="3" class="length"><input type="text" name="title" value="" ></td>
</tr>
<tr> 
<th>{=_('内容')}</th>
<td colspan="3">
<input type="radio" id="textbox" name="select[]" value="1"> Textbox
<input type="radio" id="radio"   name="select[]" value="2"> radio button
<input type="radio" id="checkbox" name="select[]" value="3"> checkbox
<br> 
</td>
</tr>

解决方案 »

  1.   

    将克隆后的input的name属性改掉即可。
    比如clone1是克隆一次后的对象,
    clone1.find('input').each(funciton(){
       $(this).attr('name',‘select’ + 1);//1是克隆的次数
    })
      

  2.   

    <tr> 
    <th>{=_('内容')}</th>
    <td colspan="3">
    <input type="radio" id="textbox" name="select" value="1"> Textbox
    <input type="radio" id="radio"   name="select" value="2"> radio button
    <input type="radio" id="checkbox" name="select" value="3"> checkbox
    <br> 
    </td>
    </tr>js 代码if($('.formTable tbody tr').eq(1).find('input:radio').attr('checked'))为什么这个checked只认第一个<input type="radio" id="textbox" name="select" value="1"> Textbox,其他的选中却当attr的checked是false呢?