How to disable Enter key pressed inside TextBox to avoid submission or Postback through Javascript?

 Posted by vishalneeraj-24503 on 1/3/2015 | Category: JavaScript Interview questions | Views: 3901 | Points: 40
Answer:

Write below Javascript function and call below function on onkeydown event in textbox definition as:-
function prevent_submission()

{
return (event.keyCode!=13);
}
<asp:TextBox ID = "txt_emp_first_name"
runat = "server"
onkeydown = "prevent_submission();"></asp:TextBox>


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response