$(”#efficient”).addClass(”shortcut”);

I love JavaScript frameworks. Coming from a time when you had to code uniquely for IE (document.all) and Netscape (document.layers) most (including me) just did it for IE. Also, many of us were just learning about JS via the highly recommended Peachpit books, so we copied but didn’t understand. This was the late 1990s when Netscape still held onto a respectable portion of the browser market, but was waning fast due to IE 3. It was a brutal, semi-cryptic world of copy/pasta from websites that allowed you to perform amazing feats like rollover image swaps. Form validation was also the cat’s pajamas but very rickety since most people would only check for an actual length of string instead of whether the contents were valid.

Then, along came document.getElementById(nameOfId) and suddenly, scripting became easier. A LOT easier. Now, whether you were using IE or Firefox you could target the same element in the exact same way provided that element had id=”nameOfElement” in it. This simplified using conditionals to determine the browser. Changing the style, font, background image, etc. was easy peasy. However, it was still messy with doing AJAX as IE (again) had a unique function call for initiating the necessary action, but it was still necessary.

NOW, we have the very efficient and very easy-to-learn (if you have some actual coding ability) JavaScript application frameworks. jQuery, Prototype, MooTools to name a few. I stick with jQuery primarily because it’s the one I was first exposed to. I dabbled with MooTools prior but found it very cumbersome at the time; this also was due to my lack of overall understanding. Each framework has its proponents, but 90% of them share the same basic utility and features. Their extensibility is where they really shine, allowing you to add AJAX on the fly, quick and painless form validation for a dozen types of data, animation and interactivity that would take hundreds of lines of code otherwise, and best of all, graceful degradation if someone doesn’t wish to use JS in their browser (nowadays, that’s quite rare).

I could tout on forever about all the sweet benefits it offers to those of us who are tired of reinventing the wheel of JS methods and objects for the same things, or wish to have nice and tidy code for simple features like mouseover opacity (IE6 required ugly hacks for this) and making sure an email entered is in a valid format.

Share Your Thoughts