我有一个accordion表,我想使用Jquery和checkboxes.To来获取行id的值,这样会让事情变得更简单。我正在使用一个隐藏值field.when,我尝试这样做:隐藏的输入id总是设置为最后一行的值,而不是给我所有的值。
我的手风琴桌innerHTML是这样的
<div id="acc22" class="accBox">
<p class="accordianHead">
<div class="accordianBody">
<form id="form_22" action="" method="post" encoding="">
<div style="display:none;">
<table id="item_tbl_22" class="accTable" cellspacing="0" cellpadding="0" border="0" width="100%">
<thead class="greyBg paddingHead">
<tbody>
<input id="cloth_id22" type="hidden" value="72" name="fabric_id">
<input id="cloth_colour_id22" type="hidden" value="824" name="data[Cloth][cloth_id]">
<tr id="S3639-1-1_824" style=" ">
<tr id="S3639-1-2_824" style=" ">
<tr id="S3639-1-3_824" style=" ">
<tr>
</tbody>
</table>
</form>
</div>这是我的隐藏id
<input type="hidden" id="form_te[<?php echo $id;?>]" value="<?php echo $tbl_content;?>" />这是我的Jquery方法
$("input[name='s_i_width[]']:checked").each(function(event) {
printArray.push($('#form_te'+ this.value).val());
console.log($('#form_te'+ this.value).val());如何将其存档?
发布于 2016-05-20 16:50:33
很抱歉,我认为特殊字符需要添加额外的代码。尝尝这个。
$("#form_te\\["+<?php echo $id;?>+"\\]").val()谢谢你们这些家伙。Find DOM element by ID when ID contains square brackets?
https://stackoverflow.com/questions/37340467
复制相似问题