<table class="container">
<tr>
<td><input type="text" class="foo"></td>
</tr>
<tr>
<td><input type="text" class="foo"></td>
</tr>
<tr>
<td><input type="text" class="foo"></td>
</tr>
</table>
<script>
$(".container tr").click(function(){
alert($(this).find("foo").val());
});
</script>
它应该做什么:
当我单击表格行时,它将找到该元素内的输入并提醒其值。
谢谢你!
你错过了.
在你的类选择器中:
alert($(this).find(".foo").val());
FIDDLE: http://jsfiddle.net/wUgt5/ http://jsfiddle.net/wUgt5/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)