jQuery动态添加的HTML,获取参数问题!<input type="checkbox" name="aaa" checked="checked" value="A" />
<input type="checkbox" name="aaa" checked="checked" value="B" />
$('#cabinTable').clone(true).appendTo('#cabinList');
用jquery怎么样能把name="aaa"换成另一个参数。以便后台获取参数的时候能区分?

解决方案 »

  1.   

    $('#cabinTable').clone(true).attr("name","bbb").appendTo('#cabinList');
      

  2.   

    $('#cabinTable').clone(true).attr('name', 'bbb').appendTo('#cabinList');
      

  3.   

    如果是是一批HTML标记,就不管事了。
      

  4.   

    <table border="1" id="Table1">
            <tr>
             
                <td colspan="5">
         
                    <input type="checkbox" name="CabinCode" checked="checked" value="A" />A
                    <input type="checkbox" name="CabinCode" checked="checked" value="D" />D
                    <input type="checkbox" name="CabinCode" checked="checked" value="J" />J
                    <input type="checkbox" name="CabinCode" checked="checked" value="Z" />Z
                    <input type="checkbox" name="CabinCode" checked="checked" value="P" />P
                    <input type="checkbox" name="CabinCode" checked="checked" value="T" />T
                    <input type="checkbox" name="CabinCode" checked="checked" value="W" />W
                    <input type="checkbox" name="CabinCode" checked="checked" value="U" />U
                    <input type="checkbox" name="CabinCode" checked="checked" value="V1" />V1
                    <input type="checkbox" name="CabinCode" checked="checked" value="V" />V
                    <input type="checkbox" name="CabinCode" checked="checked" value="G" />G
                </td>
            </tr>
            <tr>
      
                <td>
                    <input type="text" id="Text4" name="beginDate" />
                    <input type="text" id="Text5" name="endDate"  />
                </td>
            
                <td colspan="2">
                    <input type="text" />
                </td>
            </tr>
            <tr>
           
                <td>
                    <input type="text" id="Text6" name="beginDate"  />
                    <input type="text" id="Text7" name="endDate"  />
                </td>
            
                <td>
                    <input type="text" />
                </td>
                <td>
                    <input type="button" id="Button3" value="添加" />
                    <input type="button" id="Button4" value="删除" />
                </td>
            </tr>
        </table>点添加,复制整个Table;点删除,就删除整个Table.
    添加3个Table,提交表单,参数怎么接受?
      

  5.   


    你删除整个table是不行的把,整个table没了,按钮都没了。
    想要什么效果呢?
      

  6.   


    那种情况不需要考虑,只考虑添加3个table,提交到后台,怎样获取参数,一个table是一组参数,要区分3个table的每组参数的。
      

  7.   

    获取表格中所有checkbox,在循环替换name值就ok 啦
    var changename=CabinCode;
    var num=0;
    for(var i=0 i<$.("input[type=checkbox]").length;i++){
        $("input[type=checkbox]").eq(i).attr("name",changename+num.toString());
    }
    num++;