In my web page i have one textbox and a button...and my requirement is soon i type the text in the text box and press enter key,the button code should get fired...im designing my web page in asp.net with c# code
thanks
thanks
function fun1(e, button2){
var evt = e ? e : window.event;
var bt = document.getElementById(button2);
if (bt){
if (evt.keyCode == 13){
bt.click();
return false;
}
}
}
//And on the textbox
TextBox1.Attributes.Add("onkeypress", "return fun1(event,'" + Button1.ClientID + "')");
//Button1 is the button whose onclick you will call when enter is pressed on TextBox1
Comment