如何选择“tbody”从下面的html代码中的函数“tbodyExpand()”使用jquery? 我试图使用$(this).closest('table').find('tbody')
但不起作用。如何通过jquery选择器选择父级的子元素?
<div class="bs-example">
<table class="table table-border table-striped table-condensed table-hover">
<thead>
<tr>
<td><b>TITLE</b><a href="javascript:void(0)" onclick="tbodyExpand()" style="float: right;">EXPAND</a></td>
</tr>
</thead>
<tbody class="hide">
<tr>
<td>ALT (U/L)</td>
<td><input class="span1" name="ALT" value="" placeholder=""></td>
</tr>
什么是$(this)引用? –
请参阅此评论:http:// stackoverflow。com/a/9122287/2812842 –
你为什么首先将inline'onclick'与jQuery结合起来?只需使用jQuery http://api.jquery.com/click/ – charlietfl