<html>
<head>
<script src="lib/jquery.js"></script>
<title>$Title$</title>
</head>
<body>
<table>
<tr>
<td class="data">1</td>
<td><input type="button" value="get"></td>
</tr>
<tr>
<td class="data">2</td>
<td><input type="button" value="get"></td>
</tr>
<tr>
<td class="data">3</td>
<td><input type="button" value="get"></td>
</tr>
<tr>
<td class="data">4</td>
<td><input type="button" value="get"></td>
</tr>
</table>
</body>
<script type="text/javascript">
$(function () {
//点击不同的按钮,获取不同的值 ,比如点击第一个按钮获取的值是1,button 的class,id不变
})
</script>
</html>
$(function () {
$('input').click(function(){
var item = $(this).parent().parent().find('.data').text()
console.log(item)
})
//点击不同的按钮,获取不同的值 ,比如点击第一个按钮获取的值是1,button 的class,id不变
})