87,907
社区成员
发帖
与我相关
我的任务
分享
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('tr td input').each(function(){
alert(jQuery(this).val());
})
// 这个代表找的是 子节点的 td,input ,也就是和td同级别的input
// jQuery(this).children("td,input").each(function()
// 这是在当前节点下,找所有包含td,input的节点
jQuery(this).find("td,input").each(function() {
// a[i] = jQuery(this).text();
alert(jQuery(this).text());
// i++;
})