Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
123
rated 0 times [  130] [ 7]  / answers: 1 / hits: 17696  / 9 Years ago, thu, may 28, 2015, 12:00:00

I have set an onmousedown event handler for the body of my page. In this page there are some div elements, is it possible to ignore the clicks on these divs, and to just fire the onmousedown event handler of the body with the correct coordinates, as if the divs were not present?


More From » jquery

 Answers
33

If you want a click on a div to result in nothing, use this CSS declaration:



div {
pointer-events: none;
}


or use this to stop any event from firing by a click on a div:



$('div').click(function(e) {
e.stopPropagation();
});

[#66425] Wednesday, May 27, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dustin

Total Points: 599
Total Questions: 105
Total Answers: 106

Location: Belarus
Member since Tue, Mar 14, 2023
1 Year ago
dustin questions
;