Skip to content

Commit

Permalink
Improved input focusing when there are multiple fields
Browse files Browse the repository at this point in the history
  • Loading branch information
laCour committed Oct 6, 2015
1 parent 9e8250f commit 7e75cd0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gridforms/gridforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ $(function() {
},
events: function() {
var that = this;
that.el.fieldsContainers.click(function() {
$(this).find('input[type="text"], textarea, select').focus();
that.el.fieldsContainers.click(function(event) {
var focusableFields = that.el.focusableFields.selector;

if (!$(event.target).is(focusableFields)) {
$(this).find('input[type="text"], textarea, select').first().focus();
}
});
that.el.focusableFields.focus(function() {
that.focusField($(this));
Expand Down

0 comments on commit 7e75cd0

Please sign in to comment.