Created
March 1, 2018 01:51
-
-
Save radjivF/aa33bb48809245803c5728de8c15a8d6 to your computer and use it in GitHub Desktop.
enter key trigger parent element by default
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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