我在ASP.NET上有一个简单的html按钮,点击按钮我想清除textbox1,关注textbox1并防止回发。我该怎么做?防止回发也会停止按钮的清除和聚焦功能。谢谢
$("#button1").click(function () {
var text1 = $("#textbox1").val();
$.connection.moveshapehub.server.sendmessage1(text1); //send text to hub
//want to clear textbox1 + focus on textbox1
return false; //prevent asp.net postback
});
$("#button1").click(function (e) {
e.preventDefault();
var text1 = $("#textbox1").val();
$.connection.moveshapehub.server.sendmessage1(text1); //send text to hub
//want to clear textbox1 + focus on textbox1
$("#textbox1").focus().val("");
return false; //prevent asp.net postback
});