Skip to content

Instantly share code, notes, and snippets.

@andreychev
Created October 16, 2013 12:12
Show Gist options
  • Save andreychev/7006740 to your computer and use it in GitHub Desktop.
Save andreychev/7006740 to your computer and use it in GitHub Desktop.
initSaveOnEnter
initSaveOnEnter: function() {
this.popup
.off('keyup.saveOnEnter')
.on('keyup.saveOnEnter', function(event) {
var target = event.target,
targetEl = $(target);
if (event.which == 13 && target.tagName != 'TEXTAREA' && !targetEl.hasClass('ui-autocomplete-input') && !targetEl.hasClass('js-save_on_enter')) {
this.popup
.find('.js-submit_button')
.trigger('click');
}
}.bind(this));
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment