Javascript

How To Check If Javascript Event Was Triggered By Human

Posted by Weston Ganger on March 07, 2017

Sometimes you may want to check if the javascript event was triggered by a human. Turns out that e.orginalEvent is only defined if the event was human triggered.


$('.checkbox').change(function(e){
  if(e.originalEvent === undefined){
    // triggered by code
  }else{
    // triggered by human
  }
});


Related External Links:


Posted in Javascript and Tagged with events 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts