How do I capture an event for ANY element in jQuery? Obviously $("*").click()
doesn't work. Is there some sort of selector for any element that is clicked, etc.?
Asked
Active
Viewed 33 times
-1

Someone
- 372
- 1
- 2
- 13
-
2of course it works, did you try it? – nice ass Nov 08 '13 at 16:17
-
2`$(document).on('click', function(e) { //do stuff });` – crush Nov 08 '13 at 16:18
-
"Obviously it doesn't work" -- please support this claim with a fiddle. – tymeJV Nov 08 '13 at 16:18
-
Maybe this question http://stackoverflow.com/questions/6710939/capture-all-events-click-change-onmouseover-e-t-c-for-a-given-element-using – TheMentor Nov 08 '13 at 16:19
-
Sorry, I meant doesn't work for what I'm trying to do. – Someone Nov 10 '13 at 01:31
1 Answers
1
Try with
$(document).on('click', function(){})
$("body").on('click', function(){})

Murali Murugesan
- 22,423
- 17
- 73
- 120