AnchovyLegend
AnchovyLegend

Reputation: 12538

Using `find( )` and selecting the parent element as well

I have been trying to create a highlight effect for a while now. This is extremely close to what I need however, the problem with this method is it leaves out the inner most parent element.

What I need is the exact same functionality as what the below JQuery code produces, the only difference is, I would like to include the inner-most parent object as well. Using find finds all children of the parent object, which is not exactly what I need.

Edit

I basically need the combination of these two statements:

$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>

I appreciate any help in accomplishing this.

Many thanks in advance!

Upvotes: 1

Views: 72

Answers (2)

DarkAjax
DarkAjax

Reputation: 16223

You can use .addBack():

$last.parent().parent().find('*').addBack().effect("highlight", {color: '#FCF8DC'}, 2000);

Upvotes: 1

Explosion Pills
Explosion Pills

Reputation: 191729

Use .addBack:

$last.parent().parent().find('*').addBack().effect(...)

Upvotes: 2

Related Questions