It’s often much more efficient to access DOM properties directly, rather than using jQuery. The downside to that approach is that there are differences between the various browsers, so in some cases it introduces bigger problems than the extra performance overhead.
Tag Archives: jQuery
Registering jQuery Event Handlers Before the Elements Exist
Faster jQuery Selector Calls with Chaining
Rob Tarr ran some benchmarks to prove the claim that chaining jQuery selector methods is faster than placing them all in a single method call.
Passing Extra Arguments to a jQuery Event Handler
This Fiddle shows how to pass extra parameters to an event handler function in jQuery.
admin-ajax.php Response Fails When Called from Domain Alias
jQuery document.ready() Fires Twice
There’s a bug in jQuery 1.4.3 that causes document.ready() to fire twice if there’s an unhanded exception. You can avoid it by wrapping the code that is throwing the exception inside a try/catch block.
IE Pixelates Text During Javascript Animations
If you’re performing a JavaScript animation effect on an element (e.g., jQuery’s fadeIn/fadeOut), you may notice that the text briefly pixelates in IE. You can fix that by setting a background color on the element.
Cross-Domain AJAX Requests
Alternatives to Select/Multiple
Ryan Cramer details some of the problems with select/multiple and a few good alternatives. It’s useful in certain circumstances, but unintuitive and error-prone. Instead, you can create a list of checkboxes inside an element with overflow:auto set, or use a jQuery plugin he developed.