function clickButton(e, buttonid)
var evt = e ? e : window.event;
var bt = document.getElementById(buttonid);
if (bt) {
if (evt.keyCode == 13) {
bt.click();
return false;
}
}
}
txtChatMessage.Attributes.Add("onkeypress", "return clickButton(event,'" + btnSendChat.ClientID + "')");
this function is an attribute that is set in code behind file. How do I reset the text in textbox after the button click fires
You can do it like this, by passing the text field from code behind
using this, andsettingitsvalue to empty stringin javascriptIn code behind
In javascript
The above code will over write the existing value of text box. To save it for later use we can use hidden field
In html
In javascript
In Code behind
Send text field to javascript function
Get value of textbox from hidden field