ini*_*ium -2 html jquery jquery-ui jquery-selectors
我在选择单击的 ID 内的 ap 标签时遇到一些问题,代码如下;
Run Code Online (Sandbox Code Playgroud)<tbody> <tr id="test1"> <p> Some random text that should show up in the dialog. </p> <td>test</td> <td>test</td> </tr> ... the rest of the tr's are identical, nothing else to see here. </tbody> $('#test1, #test2, #test3, #test4').click(function(){ $(this 'p').dialog(); });
现场测试;http://team-blandsaft.no-ip.org/
最好习惯在 stackoverflow 编辑器中编写一些代码。
使用.find()
$(this).find('p').dialog();
Run Code Online (Sandbox Code Playgroud)
或者您可以使用上下文选择器
$('p',this).dialog();
Run Code Online (Sandbox Code Playgroud)
它内部使用 find 方法
正如其他人提到的,您的 html 无效,作为<p>其子项<tr>
来自tr 的MDN 文档
允许的内容:零个或多个
<td>或<th>元素,或它们的混合
| 归档时间: |
|
| 查看次数: |
11357 次 |
| 最近记录: |