0

I have the below jquery code to identify user actions on html page. This is getting triggered for user action on the page or due to script doing the click . How can I differentiate user action and action by the script?

User action is for example user click on the body . script action is, programatically doing onclick on some element of the page or just simple click on the html page .

$('body').click(function() {
        console.log(new Date($.now()) + " :: " + "Body Click");
    });

Thanks.

georgeawg
  • 47,985
  • 13
  • 70
  • 91
JavaUser
  • 24,066
  • 44
  • 104
  • 130
  • 1
    User action is ..user click on the body . script action - programatically doing onclick on some element of the page. – JavaUser Apr 21 '16 at 05:46

2 Answers2

1

Take a look at this closely related question and answer. The short version is you can find out by looking at the event object for things like clientX, clientY, etc.

Community
  • 1
  • 1
HeadCode
  • 2,724
  • 1
  • 13
  • 25
0

Pass a parameter event

if e.which==undefined means action by script

Rahul Patel
  • 1,300
  • 1
  • 14
  • 15