Files
notifications-admin/app/assets/javascripts/autofocus.js
Chris Hill-Scott 776539462e Make autofocus textbox module
This commit adds a very small Javascript module to autofocus a textbox on page
load. It should only be used once per page.

It also adds a parameter to the textbox macro which adds the attribute to
trigger autofocus.
2016-02-02 16:38:10 +00:00

13 lines
223 B
JavaScript

(function(Modules) {
"use strict";
Modules.Autofocus = function() {
this.start = function(component) {
$('input, textarea, select', component).eq(0).trigger('focus');
};
};
})(window.GOVUK.Modules);