如何从重复的div id中获取重复的输入值

loading...


-1

请找到下面的HTML代码 .

<div id="accordion" class="panel panel-primary">
    <div id="heading" class="panel-heading">
        <h3 class="panel-title">Request</h3>
        <span class="pull-right clickable panel-collapsed"><i class="glyphicon glyphicon-chevron-down"></i></span>
    </div>
    <div class="panel-body" style="display: none;">
        <div id="smallboxid_0">
            <div class="row">
                <div class="form-group">
                    <label class="control-label" >Empname</label>                                           
                    <span class="text-danger field-validation-valid" data-valmsg-for="Employee.empname" data-valmsg-replace="true"></span>
                </div>
            </div>                                              
        </div>
    </div>
</div>
<div id="accordion" class="panel panel-primary">
    <div id="heading" class="panel-heading">
        <h3 class="panel-title">Request</h3>
        <span class="pull-right clickable panel-collapsed"><i class="glyphicon glyphicon-chevron-down"></i></span>
    </div>
    <div class="panel-body" style="display: none;">
        <div id="smallboxid_0">
            <div class="row">
                <div class="form-group col-md-3">
                    <label class="control-label" >Emp name</label>                                           
                    <span class="text-danger field-validation-valid" data-valmsg-for="Employee.empname" data-valmsg-replace="true"></span>
                </div>
            </div>                                              
        </div>
    </div>
</div>

<div id="accordion" class="panel panel-primary">
    <div id="heading" class="panel-heading">
        <h3 class="panel-title">Request</h3>
        <span class="pull-right clickable panel-collapsed"><i class="glyphicon glyphicon-chevron-down"></i></span>
    </div>
    <div class="panel-body" style="display: none;">
        <div id="smallboxid_0">
            <div class="row">
                <div class="form-group col-md-3">
                    <label class="control-label" >Emp name</label>                                           
                    <span class="text-danger field-validation-valid" data-valmsg-for="Employee.empname" data-valmsg-replace="true"></span>
                </div>
            </div>                                              
        </div>
    </div>
</div>

上面的html代码使用clone生成相同的内容,这里我需要获得smallboxid_0 div输入,textarea,使用jquery / .net选择任何元素值,并且我想使用ajax调用将这些值插入到数据库中 .

loading...

1回答

  • 0

    为什么你有这么多重复的id?据我所知,jquery不会在重复的id上运行良好 . 因为jquery只会确认第一次出现的唯一id . 所以有点不可能访问第二个重复ID,没有任何欺骗 .

    jQuery - Selector for duplicate ID's

    祝你今天愉快..

评论

暂时没有评论!