0

I have jquery, bootstrap included in a page I'm writing. It's a complex page. The problem I'm having is with Internet Explorer not seeing mousedown event. Chrome and FF both see the event just fine but not IE.

I wrote a test page with the event and it worked just fine in IE. So my question is...

Is there a way through the developer tools to determine what is cancelling an event?

I have a suspicion that one of the many .js files I've included is cancelling the mousedown event and IE isn't seeing it anymore. Chrome and FF does though. So I'm not 100% that it's being cancelled but it's my only guess I can come up with.

Code is really irrelevant since it's all of jquery and bootstrap. However, I am playing with divs that are draggable and resizeable. That's why I need to use jquery. The bootstrap is used because I also have a wysiwyg editor on the page.

Please don't recommend click. I need mousedown. When the mouse is down the border around the draggable and resizeable div turns red and I have some code that selects that div to capture top, left, width, and height as it's being moved and resized.

If click was selected as the event, the user would have to click the div box first then click and hold to move it. That's not a user friendly interface.

Any help is greatly appreciated.

JJJ
  • 32,902
  • 20
  • 89
  • 102
Jason L
  • 94
  • 2
  • 5

1 Answers1

0

What do you exactly mean as cancel, .preventDefault() or .stopPropagation? If we are talking about preventDefault - you should still be able to add event listener to parent container and then see your event object - it might have some data to traceback. Alternative would to override jQuery .on method and see who actually subscribes to the event.

After little more thinking - add another listener BEFORE the malicious one, to do that insert document-ready handler with event binding right after jquery loading code. In your new mousedown handler try to override problematic method of the event.

UPDATE:

you should try to check all events attached to your element one by one. To do that - check this post jQuery find events handlers registered with an object In short - try using jQuery._data( elem, "events" ); to see attached event listeners and inspect their code in your code base. After you find the reason it will be much easier to reach the desired functionality. Before that it is just a guesswork.

Community
  • 1
  • 1
Anton Boritskiy
  • 1,539
  • 3
  • 21
  • 37
  • I added the mousedown event at the top of of the $(document).ready function but it still didn't work. – Jason L Oct 15 '15 at 20:59
  • The discuss your first paragraph, I don't know what method is used to cancel the event previous or even if this is the case. All I have are no errors in the developer tools but it doesn't catch the event. – Jason L Oct 15 '15 at 21:00
  • Sorry I forget that enter on the keyboard submits. The click event does work just fine though. It's the mousedown that doesn't. – Jason L Oct 15 '15 at 21:01
  • $(document).on('click', '#div'+newDiv, function() { console.log("click that should be mousedown"); }); – Jason L Oct 16 '15 at 12:37
  • I tried listing the events but I got undefined. I did find in the DOM Explorer debugger a way to show added events to an object. The mousedown is showing as an attached event to the div0 object but it doesn't fire. I added the line below manually adding the event to the actual div0 instead of "div"+newDiv to just test. But no joy. document.getElementById('div0').addEventListener("mousedown", function() { console.log("yeah"); }); – Jason L Oct 19 '15 at 13:56