Commit c0d343ef authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Added javascript to autofocus the first element with a class of 'autofocus'

on the page. Used by the form API.
parent cf387e0b
...@@ -50,3 +50,15 @@ function processingStart(msg) { ...@@ -50,3 +50,15 @@ function processingStart(msg) {
function processingStop() { function processingStop() {
$('loading_box').style.display = 'none'; $('loading_box').style.display = 'none';
} }
// Autofocus the first element with a class of 'autofocus' on page load
addLoadEvent(function() {
getFirstElementByTagAndClassName(null, 'autofocus', document.body).focus();
});
// @todo remove this when we migrate to mochikit 1.4
if (typeof(getFirstElementByTagAndClassName) == 'undefined') {
function getFirstElementByTagAndClassName(tag, className, parentElement) {
return getElementsByTagAndClassName(tag, className, parentElement)[0];
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment