var temp=true;
$(".chat-btn").click(function(){ if(temp){
$(this).parent().next().after($("#comment-reply-box")); console.log($(this).parent().next())
}else{
$("#comment-reply-box").remove()
}
temp=!temp
})問題是這樣的當我點擊的時候插入一個div;再次點擊的時候就移除;當我第三次點擊的時候發(fā)現(xiàn)他就不插入div了;而我 console.log($(this).parent().next())都是同一個節(jié)點;請問這是怎么回事
jq插入移除節(jié)點問題
LEATH
2018-10-11 13:33:51