Setting a focus on an input box is a hassle with so many different browsers out there. Each browser has their own unique tag to set the focus. Rather than using the browser-specific tags for the focus, one can utilize Javascript to provide the functionality for multiple browsers.
jQuery is a great alternative to adding the focus since its simply a matter of adding a few lines of code to your page. It will work on multiple browsers, whether it be Internet Explorer, Firefox, Chrome, or Safari.
If you want the first visible element of the page to be focused:
<script type="text/javascript" >
$(function() {
$("input:text:visible:first").focus();
});
</script>
If you want a specific element to be focused, such as a search box:
For instance,<script type="text/javascript" >
$(function() {
$("input[name=\'MY_INPUT_NAME\']").focus();
});
</script>
will set the focus for your input element with the name “MY_INPUT_NAME”.
Alternatively, you can use HTML5