It is working fine in IE whereas in FireFox it is not working and for the enter key press, the AddNew functionality is invoked.
The following is the js function.
function noenter() {
if (window.event.keyCode == 13)
{
document.getElementById('<%=cmdSearch.ClientID%>').click();
return false;
}
}
this is how it is called for onkeypress event of the textbox.
Issue:
The issue is that the event is not recognized by Firefox and IE was able to detect the event with the help of the window.event object.
Workaround:
The workaround will be to pass the event from the textbox to the javascript method. So the change in the javascript function will be as follows
function noenter(e) {
if (e.keyCode == 13)
{
document.getElementById('<%=cmdSearch.ClientID%>').click();
return false;
}
}
and the onkeypress event of the textbox will be as follows
Thus, Firefox is now able to recognize the event. :)
No comments:
Post a Comment