一段时间以来,我一直在尝试创建高光效果。这非常接近我的需要,但是,此方法的问题是它遗漏了最内层的父元素。
我需要的是与下面的 JQuery 代码生成的功能完全相同的功能,唯一的区别是,我还想包括最内层的父对象。使用 find
查找父对象的所有子对象,这并不是我所需要的。
编辑
我基本上需要这两个语句的组合:
$last.parent().parent().find('*').effect("highlight", {color: '#FCF8DC'}, 2000);
$last.parent().parent().effect("highlight", {color: '#FCF8DC'}, 2000);
HTML
<div class="invoice-line">
<div class="prod-id-cell"><input type="text" class="prod-id-input"></div>
<div class="prod-name-cell"><input type="text"class="prod-name-input"/></div>
</div>
我感谢任何帮助实现这一点。
非常感谢!
最佳答案
使用.addBack
:
$last.parent().parent().find('*').addBack().effect(...)
关于javascript - 使用 `find( )` 并选择父元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15167815/