Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 当复制不起作用时,在内的内下拉_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 当复制不起作用时,在内的内下拉

Javascript 当复制不起作用时,在内的内下拉,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我有一段代码,允许我复制div=tableOfTables,但是当我复制时,我可以用唯一的id复制整个fieldset id=group_1。 当我保留 <select> ...code... </select> 块,不允许复制字段集。 在需要复制的字段集中放置下拉列表是否违反CSS规则 <form> <fieldset id="group_1"> <legend>Group# 1</legend

我有一段代码,允许我复制div=tableOfTables,但是当我复制时,我可以用唯一的id复制整个fieldset id=group_1。 当我保留

<select>
    ...code...
</select>
块,不允许复制字段集。 在需要复制的字段集中放置下拉列表是否违反CSS规则

<form>
    <fieldset id="group_1">
        <legend>Group# 1</legend>Duplicate text
        <div id="tableOfTables" class="formfield">
            <table id="dataTableInner">Group# from table</table>
            <tr>
                <td>hi</td>
                <td>
                <select>
                    <option value="item1">Equals</option>
                    <option value="item2">Less Than</option>
                    <option value="item3">Greater Than</option>
                </select>
                </td>
            </tr>
        </div>
    </fieldset>
</form>

$('#add_one_more_group').click(function (event) {

    // Clone the first fieldset
    var item = $('fieldset[id^="group_"]:first').clone();

    // Search for the greatest existing fieldset ID
    var max_index = 0;
    $('form').children('fieldset[id^="group_"]').each(function () {

        var pattern = new RegExp("^group_([0-9]*)$");
        var matchArray = pattern.exec($(this).attr('id'));
        if (matchArray !== null && matchArray.length == 2) {
            max_index = Math.max(max_index, matchArray[1]);
        }
    });
我可以看到一个下拉选项在字段集中运行良好,但整个字段集不能复制


这是一个。

您已经关闭了表标记,这将破坏您的标记。移动到“最后一个感谢”下面,谢谢你指出,但没有多大帮助。我想这可能会有更大的帮助:我认为我的JS可能有一些错误,没有正确地引用ID,但我需要一双额外的眼睛。谢谢你帮助我