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

 Posted by vishalneeraj-24503 on 7/9/2014 | Category: JavaScript Interview questions | Views: 527 | 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