【发布时间】:2017-10-08 14:30:48
【问题描述】:
我正在尝试使用 find().val() 在 jquery 数据表中获取动态隐藏输入的值,但它返回未定义。如何使它返回输入的值?
//foreach instantiate
<input style="display: none;" value="{{$userTable['username']}} - {{$userTable['name']}}" />
//end foreach instantiate
jquery 试图获取隐藏输入的值。
$.each($("#datacal_table tr"), function(){
arrTableName.push($(this).find('input').eq(0).val());
});
表格布局
<table id="datacal_table"
class="table table-striped table-bordered" cellspacing="0">
<thead>
<tr>
<th>Username</th>
<th>Type</th>
<th>Name</th>
<th>Computation Sheet Name</th>
<th>Status</th>
<th>Date</th>
</tr>
</thead>
<tbody id="dctbody">
//foreach instantiation
<tr>
<td id="username_table">
{{$userTable['username']}} <br>
{{$userTable['name']}}
<input style="display: none;" value="{{$userTable['username']}}
- {{$userTable['name']}}" />
</td>
......<td> values
<tr>
//end for each
</tbody>
</table>
【问题讨论】:
-
段落
find('p')没有值。
标签: javascript jquery laravel