javascript - Dynamically changing which button is pressed with "enter" -
i have form 2 buttons , text inputs. default if press enter "click" first button. i'd make if type in either of text boxes, if press enter second button 1 clicked. in simplified example below, pressing enter default "click" log in using facebook button. happen if entered in email or password text inputs. i'd if entered in either email or password inputs, pressing enter "click" login email/password button. <form> <button class="login-facebook">log in facebook</button> <input type="text" class="email" placeholder="email"><br> <input type="password" class="password" placeholder="password"><br> <button class="login-password">log in email/password</button> </form> goal like: $('.email').add('.password').on('change', function() { $('.login-password')....