我有一个问题.
代码是这样的:
$("#button").click(function(event){
$("#threads").html("hi");
});
Run Code Online (Sandbox Code Playgroud)
当我点击按钮时,文本"hi"仅在1秒内显示.然后它消失了.我希望它在点击后总是显示出来.我怎样才能做到这一点?
Pet*_*dIt 29
试试这个:
$("#button").click(function(event){
event.preventDefault();
$("#threads").html("hi");
});
Run Code Online (Sandbox Code Playgroud)
我的猜测是按钮是一个[a href]标签,或者是一种导致页面刷新的形式.