Hi everybody,
I am trying to do relatively simple things:
1. Set focus on a particular control when the form is loaded
2. When I enter a text in the search control and press Enter, fire the Search button click.
Here is what I am trying in the main js script which is loaded from the _Layout.cshtml:
$('#frmClientsSearch').ready(function () {
alert($("#searchClientName"));
$("#searchClientName").focus();
});
$("#searchClientName").keyup(function (event) {
alert("searchClientName keyup");
if (event.keyCode == 13) {
$("#btnClientsSearch").click();
}
});
Here is the behavior I observe in FireFox:
1. Even before I call the Client form from the menu, I got the first Alert. After I call that form from the menu, the alert is shown again, but the focus is not set
2. The KeyUp never seems to fire
Also, in firefox TAB doesn't seem to work at all although it works in Google Chrome - e.g. I can tab out from one textbox to another.
Do you see what may be wrong?
Thanks in advance.
If it's not broken, fix it until it is.
My Blog