我正在 iframe(带有 facebox)中加载表单。提交表单并重新加载 iframe 内的页面后,我想将 CSS 类添加到父页面上的特定表格行。
表格如下所示:
<table>
<tr id="row-1"><td><a href="">link to open facebox with iframe</a></td></tr>
<tr id="row-2"><td></td></tr>
<tr id="row-3"><td></td></tr>
<tr id="row-4"><td></td></tr>
</table>
在 iframe 中提交表单后,父框架中的表格应如下所示:
<table>
<tr id="row-1" **class="highlite"**>
<td><a href="">link to open facebox with iframe</a></td>
</tr>
<tr id="row-2"><td></td></tr>
<tr id="row-3"><td></td></tr>
<tr id="row-4"><td></td></tr>
</table>
社区可以帮助我正确实现吗?
最佳答案
$("#row-1", window.parent.document).toggleClass("highlite");
引用Pim Jager :
The second parameter for the
$()
wrapper is the context in which to search. This defaults to document.
关于javascript - 使用 jQuery 在 iframe 中加载页面后,将 CSS 类添加到表格行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3492115/