0

I'm trying to capture the click events,
But for some elements the click event is not firing
Example search box and search button in Bing
I have tried injecting all the below code in Bing
it is capturing all the elements except the input searchbox and search button But the below code is working perfectly in google, yahoo searchbox and buttons

window.onclick=function(e){console.log(e)};
window.addEventListener("click",function(e){console.log(e)});
document.addEventListener("click",function(e){console.log(e)});

Please tell me why that is not being captured or fired and how to capture that element click

Madhan
  • 5,750
  • 4
  • 28
  • 61

1 Answers1

0

Inorder to capture the events the events should be captured through event capturing not via event bubbling.the useCapture flag is my culprit here.Set it to true and it solved my problem..
Bubble vs capture

window.addEventListener("click",function(e){console.log(e)},true);
document.addEventListener("click",function(e){console.log(e)},true);
Community
  • 1
  • 1
Madhan
  • 5,750
  • 4
  • 28
  • 61