请帮忙,我是 jquery 的新手。有 3 个表格将填充文本框并动态下拉“选择”
<table class="primaGridViewSmall" border="0" cellpadding="0" width="95%"
id="shareAddUserMember" runat="server" clientidmode="Static" align="left">
</table>
<table class="primaGridViewSmall" border="0" cellpadding="0" width="95%"
id="shareAddUserMemberA" runat="server" clientidmode="Static" align="left">
</table>
<table class="primaGridViewSmall" border="0" cellpadding="0" width="95%"
id="shareAddUserMemberB" runat="server" clientidmode="Static" align="left">
</table>
该表可以有很多文本框和“选择”下拉菜单,通过单击“添加更多”动态添加。实际上我想从文本框中实现这样的事情并在该表中选择
var array = [];
var j = 0;
$('#shareAddUserMember tr').each(function () {
var memberID = ? // Dynamic_textbox_value;
var privilage = ? // Dynamic_drop_down_selected value ie type <select>
if (memberID != "") {
array[j] = memberID + ":" + privilage;
j++;
}
});
我试过这个来获取文本框的值,我也需要选择
$('#shareAddUserMember tr').each(function () {
$('input[type=text]').each(function (i, item) {
var grade = $(item).val();
alert(grade);
});
});
但是上面的代码将获取页面中的所有输入类型。我有多个表。我需要在表 shareAddUserMember 内动态创建(动态生成的 ID)的文本框中获取值。
我只需要 id =“shareAddUserMember”而不是 shareAddUserMemberA 或 shareAddUserMemberB 的表内的文本框的值。
$('#shareAddUserMember tr').each(function () {
// ---what to write here to fetch the textbox and drop down selected values-----------
});
实际上我想从文本框中实现这样的事情,然后在该表中选择输入类型
var array = [];
var j = 0;
$('#shareAddUserMember tr').each(function () {
var memberID = ? // Dynamic_textbox_value;
var privilage = ? // Dynamic_drop_down_selected value ie type <select>
if (memberID != "") {
array[j] = memberID + ":" + privilage;
j++;
}
});
在 tr 里面有下拉并选择示例 DOM
<table class="primaGridViewSmall" border="0" cellpadding="0" width="95%"
id="shareAddUserMember" runat="server" clientidmode="Static" align="left">
<tr id="EmailIDUserRow1">
<td style="text-align: center; width: 3%;">
<input type="hidden" id="EmailUserMemberID1" name="EmailUserMemberID1" />
</td>
<td align="left">
<select style="width: 150px" name="select1" id="select1">
<option value="">Select</option>
<option value="1">Full Access </option>
<option value="0">View Only</option>
</select>
</td>
</tr>
</table>