I've debugged this in IE9 and FF6.0.2 and get the same problem in both. Because I reload the same page in JSFiddle to simulate my dynamic content it wires up the JavaScript twice so clicking the red or green div's again will have strange results.
4) click on the rows in the table again and you will see that they no longer update the Values under the heading "Results". Open the link and click to "Fork" (in the top menu) to get started. CDN provided by MaxCDN, jQuery.load breaks custom event listeners.
I have narrowed down the problem further while attempting to build a repro on JSFiddle. I tried it with the jQuery Edge version and it still repro's. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ http://jsfiddle.net/WZ3BM/10/show/. I.e.
This method brings a lot of consistency to the API, and we recommend that you use this method, as it simplifies the jQuery code base. Event methods trigger or attach a function to an event handler for the …
Thanks for taking the time to contribute to the jQuery project! Repro steps: I've debugged this in IE9 and FF6.0.2 and get the same problem in both. Hosting provided by Media Temple I have a couple listeners registered for a custom event via: $('#someElementId').bind('myCustomEvent', function (event, data) { /* do something */ }); And I have a call to $.event.trigger('myCustomEvent', id); in a click handler elsewhere. jQuery will pass through the browser's standard JavaScript event types, calling the handler function when the browser generates events due to user actions such as click. I've tested with jQuery 1.6.1 and 1.6.4. If, in addition to the URL, I provide a filter to select some sub element from the results, or I load partial markup which does not contain a head with script tags, then there is no problem. You can drill down further on each of those actions to see where the initial declaration is occuring. The problem with calling .load (or $.get) only occurs for me when loading a full page that contains script tags etc.
As of jQuery version 1.7, the off() method is the new replacement for the unbind(), die() and undelegate() methods. Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. Nice article, but to trigger registered events programatically on any DOM element, you can use the EventTarget.dispatchEvent method, like for example: btn=document.getElementById('buttonx'); btn.dispatchEvent(new MouseEvent('click')); // this will make any click event listener on the button to be invoked you can also use (new Event('click') simply) Using $.get instead of load also breaks the listeners firing. In Internet Explorer, I … Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. jQuery makes it straightforward to set up event-driven responses on page elements. In addition, the .trigger() method can trigger both standard browser event names and custom event names to call attached handlers. Here is a link to a repro on JSFiddle: The off() method is most often used to remove event handlers attached with the on() method. Also in: Events > Event Object.
I've tested with jQuery 1.6.1 and 1.6.4.
You need to run it including the "/show/" part of the URL because trying to run within JSFiddle raises errors. The element where the currently-called jQuery event handler was attached. jQuery Event Methods. On the right sidebar you’ll see a tabbed section where you can click Event Listeners and see the actions that the document is listening for. The override of the $ variable kills the knowledge of the custom event when triggering. 3) click on the 'X' in the "popup" div to close it. If I had the following somewhere in my code. event.isDefaultPrevented() Any event names can be used for the events argument. 1) click on the rows in the table and see that the Values under the heading "Results" are updated with what is in the clicked on row. These methods — including .click(), .focus(), .blur(), .change(), etc. These events are often triggered by the end user's interaction with the page, such as when text is entered into a form element or the mouse pointer is moved. Each time you are loading the "dynamic content", you are loading jQuery and your script again. The problem only occurs when loading a full page with script tags and not doing a subselect against its content. Hi How do I access a list of event handlers (added by jQuery) associated with a particular DOM node ? In some cases, such as the page load and unload events, the browser itself will trigger the event.jQuery offers convenience methods for most native browser events.