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
  • 48,608
  • 13
  • 72
  • 95
JavaUser
  • 25,542
  • 46
  • 113
  • 139
  • 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,770
  • 1
  • 14
  • 26
0

Pass a parameter event

if e.which==undefined means action by script

Rahul Patel
  • 1,386
  • 1
  • 14
  • 16