我正在尝试更改div元素的同级元素,这是我使用的语句
$('.edit').click(function(){
this.siblings('.innerInfo').html("success");
});它一直抛出<HTMLDivElement> has no method 'siblings'异常,我真的不知道为什么。我启动了jQuery,I在document.ready上启动了脚本
谢谢你的帮忙!
发布于 2011-06-03 23:34:39
使用$(this)而不是this。
发布于 2011-06-03 23:35:54
你应该像这样引用$(this):
$('.edit').click(function(){
$(this).siblings('.innerInfo').html("success");
});https://stackoverflow.com/questions/6229198
复制相似问题