我知道if语句关闭时有一个小错误。
任何人都可以告诉我,如何在If语句中声明click函数?
if (($("#target").click(function () {
$("#thediv").scrollTop = $("#thediv").scrollHeight;
});
})
else {
$("#thediv2").scrollTop = $("#thediv").scrollHeight;
}
答案 0 :(得分:0)
您可以将其绑定到
$('document').on('click',function(event){
if(event.target.id == 'target'){ ... }
else {}
...
})