Autofocus the search field on the index page

This commit is contained in:
Paweł Paprota 2012-12-13 19:14:58 +00:00 committed by Tom Hughes
parent 00548468ac
commit bdc536d126
2 changed files with 7 additions and 1 deletions

View file

@ -128,4 +128,10 @@ $(document).ready(function () {
if ($("#query").val()) {
$("#search_form").submit();
}
// Focus the search field for browsers that don't support
// the HTML5 'autofocus' attribute
if (!("autofocus" in document.createElement("input"))) {
$("#query").focus();
}
});