1

I have a text field, and i want to trigger a function whenever any of the following events take place 1. KeyPress (as the user types) 2. onChange (whenever value changes or updated) 3. focusChange (whenever user tabs in or out of focus) 4. enter (whenever user press ENTER key while focus on the field)

I know several ways to do this but what's the shortest way to code this?

something like,

$(".auto-calc").on("keypress,change,focus,enter",function (){
    autoCalc();
});

Anything?

Code Maniac
  • 37,143
  • 5
  • 39
  • 60
BrownChiLD
  • 3,545
  • 9
  • 43
  • 61

0 Answers0