开发者

<HTMLDivElement> has no method 'siblings'

开发者 https://www.devze.com 2023-03-10 01:30 出处:网络
Im trying to change a sibling of a div element and this is the statemen开发者_StackOverflow社区t i used

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

精彩评论

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