<html>
<head>
<title>测试</title>
</head>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function (){});
function showMsg(){
var str=‘‘;
var s= $(‘.tr_1‘).children();
$.each(s,function (i,item){
str+=$(item).find(‘input‘).val()+‘,‘;
})
alert(str);
}</script>
<body>
<table>
<th>1</th><th>2</th><th>3</th>
<tr class="tr_1">
<td><input type="text" value="0"/></td>
<td><input type="text" value="1"></td>
<td><input type="text" value="2"/></td>
</tr>
</table>
<input type="button" value="测试数据" onclick="showMsg()"/>
</body>
</html>
查看子元素下下面的元素
时间: 2024-10-11 08:56:31