All Questions

2515
votes
9answers
700017 views

event.preventDefault() vs. return false

When I want to prevent other event handlers from executing after a certain event is fired, I can use one of two techniques. I'll use jQuery in the examples, but this applies to plain-JS as well: 1. e...
748
votes
4answers
261522 views

What is event bubbling and capturing?

What is the difference between event bubbling and capturing? Of the two, which is the faster and better model to use?
1030
votes
14answers
660239 views

window.onload vs $(document).ready()

What are the differences between JavaScript's window.onload and jQuery's $(document).ready() method?
396
votes
10answers
473365 views

How to trigger event in JavaScript?

I have attached an event to a text box using addEventListener. It works fine. My problem arose when I wanted to trigger the event programmatically from another function. How can I do it?
229
votes
14answers
276438 views

Is it possible to simulate key press events programmatically?

Is it possible to simulate key press events programmatically in JavaScript?
126
votes
6answers
52009 views

What is DOM Event delegation?

Can anyone please explain event delegation in JavaScript and how is it useful?
247
votes
14answers
295985 views

jQuery callback on image load (even when the image is cached)

I want to do: $("img").bind('load', function() { // do stuff }); But the load event doesn't fire when the image is loaded from cache. The jQuery docs suggest a plugin to fix this, but it doesn't ...
471
votes
15answers
1051789 views

jQuery.click() vs onClick

I have a huge jQuery application, and I'm using the below two methods for click events. First method HTML <div id="myDiv">Some Content</div> jQuery $('#myDiv').click(function(){ ...
504
votes
13answers
355853 views

On - window.location.hash - Change?

I am using Ajax and hash for navigation. Is there a way to check if the window.location.hash changed like this? http://example.com/blah#123 to http://example.com/blah#456 It works if I check it wh...
443
votes
9answers
1019243 views

window.onload vs document.onload

Which is more widely supported: window.onload or document.onload?

Previous Next