nkcmr
nkcmr

Reputation: 11010

<HTMLDivElement> has no method 'siblings'

Im trying to change a sibling of a div element and this is the statement i used

$('.edit').click(function(){
    this.siblings('.innerInfo').html("success");
});

It keeps throwing the <HTMLDivElement> has no method 'siblings' exception, and i really cant figure out why. I've initiated jQuery and ive started the script on document.ready

thanks for your help!

Upvotes: 5

Views: 7506

Answers (2)

psousa
psousa

Reputation: 6726

You're should reference $(this) like:

$('.edit').click(function(){
    $(this).siblings('.innerInfo').html("success");
});

Upvotes: 0

Celmaun
Celmaun

Reputation: 24762

Use $(this) instead of this.

Upvotes: 13

Related Questions