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.
Category Archives: JavaScript
Passing Extra Arguments to a jQuery Event Handler
This Fiddle shows how to pass extra parameters to an event handler function in jQuery.
Why Hash-bang URLs are Bad
Preventing Sites From Opening New Tabs/Windows
My First Shot at Adaptive Images
Passing Multi-Dimensional Arrays from WordPress to JavaScript
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.
Associative Arrays in JavaScript
JavaScript doesn’t support true associative arrays, but because data types are defined as objects, the common syntax works. This is a bad practice, though. You should just create a new object.
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
Lightbox Clones
The Lightbox Clones Matrix is a list of scripts that do inline popups, ala Lightbox. You can filter by JavaScript frameworks and features.
Preloading Images
Passing Arguments to an Event Handler
Mark Wilton-Jones has a good overview of the most common methods passing arguments to an event handler in JavaScript. This page has a function (addevent2()) that worked for me.