Skip to content

Commit

Permalink
Merge pull request #39 from laCour/patch-1
Browse files Browse the repository at this point in the history
Improved input focusing when there are multiple fields
  • Loading branch information
kumailht committed Oct 10, 2015
2 parents 9e8250f + 7e75cd0 commit c2139cc
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 c2139cc

Please sign in to comment.