循环获取每个TD里的值,但是TD中包含INPUT类型的值无法获取
function check_form()
{
//alert(jQuery("#tableList").children("tr").length);
// alert( jQuery("#tableList").find("tr").length);
//jQuery("#tableList tr").click(function()
jQuery("tr").each(function () {
var a = new Array();
var i = 0;
jQuery(this).children("td,input").each(function() {
// a[i] = jQuery(this).text();
alert(jQuery(this).text());
// i++;
})
})
}
</script>
</head>
<body>
<table border="1" id="tableList">
<tr>
<td width="50" class="auto">1.0</td>
<td class="auto" width="50"><b>1.1</b></td>
<td class="auto" width="50"><b>1.2</b></td>
<td class="auto" width="50"><b> <input type=text name="Remarks" class="BigInput" value="123"> </b></td>
</tr>
<tr>
<td width="50" class="auto"><b>2.0</b></td>
<td class="auto" width="50"><b>2.1</b></td>
<td class="auto" width="50"><b>2.2</b></td>
<td class="auto" width="50"><b> <input type=text name="Remarks" class="BigInput"> </b></td>
</tr>
<tr >
<td width="50" class="auto"><b>3.0</b></td>
<td class="auto" width="50"><b>3.1</b></td>
<td class="auto" width="50"><b>3.2</b></td>
<td class="auto" width="50"><b> <input type=text name="Remarks" class="BigInput"> </b></td>
</tr>
</table>
<input id="queryBtn" type="button" onclick="check_form();"value="开始查询">
</body>
只能得到alert ( 1.0 1.1 1.2 空 2.0 2.1 2.2 空 3.0 3.1 3.2 空)
这样循环除了IPNUT的值之外都能出来,有啥办法在里面加个选择器把IPNUT的值也给循环出来吗?
...全文
相关推荐
jquery遍历table的tr获取td的值实现方法
最后通过`tdArr.eq(index).find("input").val()`获取每个`<td>`内`<input>`元素的值,这里的index是`tdArr`数组中的索引,分别对应不同的输入值,比如收入类别
jquery获取input输入框中的值
### jQuery 获取其他类型的输入值1.
vue获取input输入值的问题解决办法
在Vue.js中处理多行input输入框的问题时,遇到的一个常见挑战是如何获取和管理这些输入的值,特别是当数据来自后台并以列表的形式呈现。当你在`v-for`循环中创建多个输入框,每个关联于列表中的一
js与jquery获取input输入框中的值实例讲解
还可以方便地获取其他类型的input元素的值,例如:- **获取radio单选框的值**(假设所有radio的name属性相同): ```javascript $("input[name=element_name
jQuery 获取遍历获取table中每一个tr中的第一个td的方法
知识点七:隐藏字段的使用每个`<tr>`的最后一个`<td>`中包含了隐藏的`<input>`类型字段,其`name`属性为`"question_numbers[]"`。


