javascript submit form with tab key
snippet in javascript

javascript submit form with tab key

user2816

            jQuery.noConflict();
            (function ($) {
                $(document).ready(function(e) {
                    let baseForm = $("#FORM_ID"); //Enter Form's ID

                  //Enter Input's ID
                  baseForm.on("keydown", "#INPUT_ID", function(evt){
                    	let charCode = evt.keyCode || e.which;   

                        // If ENTER(13) or TAB(9) entered, submit form
                        if(charCode === 9 || charCode === 13){
                            evt.preventDefault();
                            baseForm.submit();  
                        }
                    });
                });
            })(jQuery);