Skip to content

Instantly share code, notes, and snippets.

@radjivF
Created March 1, 2018 01:51
Show Gist options
  • Save radjivF/aa33bb48809245803c5728de8c15a8d6 to your computer and use it in GitHub Desktop.
Save radjivF/aa33bb48809245803c5728de8c15a8d6 to your computer and use it in GitHub Desktop.
enter key trigger parent element by default
$(event.currentTarget).on("keypress", function(event){
if(event.keyCode ===13){
var e = $.Event("focusout");
$(event.currentTarget).trigger(e);
event.preventDefault;
return false;
}
})
//or
$("#form_field_additional_tags .bootstrap-tagsinput input").on("keypress", function(event){
if(event.keyCode ===13){
var e = $.Event("focusout");
$("#form_field_additional_tags .bootstrap-tagsinput input").trigger(e);
event.preventDefault;
return false;
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment