JavaScript Chapter 12 Javascript Libraries

Javascript Libraries

A Javascript library is a file full of ready-made code that you can add a reference to in your web page. This ready-made code can be a great time saver, and helps you do things like browser detection more easily. These libraries are usually free to download. The most well known is one called jQuery. Its strength is helping you access the DOM (Document Object Model). Another good one is Modernizr. It's especially good for browser detection, HTML5 and CSS3.

Javascript libraries can be difficult to use, and whole books have been written on them, especially jQuery. To get started with jQuery, take a look at these two sites:
For Modernizr, the site is here:
Other popular libraries are:
DojoToolkit http://dojotoolkit.org )
Good if you want to target mobile apps, but has a lot more features than that. It has a widget framework that allows you to code whole web browser app. You can add things like calendars, date pickers, menus, toolbars, file uploaders and tons more.
MooTools ( http://mootools.net/ )
Aimed more at the intermediate to advanced Javascript programmer. But does pretty much what jQuery does. Plenty of arguments out there on which is the better of the two!
YUI http://yuilibrary.com/ )
Yahoo User Interface is a library on par with Dojo in that it's more widget oriented. Good community of users.
When choosing a library, though, always bear in mind what it is you're trying to do. If you want to add a fancy widget then go for Dojo or YUI. If you want to access the HTML and CSS in your page then go for jQuery or MooTools. And remember: Javascript libraries can take some time to get the hang of.

Comments