开发者

<HTMLDivElement> has no method 'siblings'

Im trying to change a sibling of a div element and this is the statemen开发者_StackOverflow社区t 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!


Use $(this) instead of this.


You're should reference $(this) like:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜