Wednesday, January 9, 2008
Adding pizazz to a title
Browsing various web templates, you might notice a technique often used for titles where the last word of the title is a different color than the rest of the title.

It's a minor change, but it does add some interest to those titles.
Because it's irrelevant to the core HTML, we do not like to modify the HTML directly to add something like this.
Instead, we use the concept of unobtrusive JavaScript which can update the page on loading (actually a little bit before loading) with extraneous HTML like this.
We prefer to use JQuery as our library of choice for JavaScript. It's a small sized JavaScript library and very nice in its approach to DOM navigation. You can reference elements in the same way you would in the stylesheet. But I don't want to get into all that, you can read about JQuery on your own.
So by adding the JQuery JavaScript file to the theme document and also a short JavaScript to do the work, you can have this technique enabled on your site.

If this is the only JavaScript you are going to use on your entire site, you may make the determination that this little feature is not worth loading two JavaScript files. But on the other hand, if you want a little pizazz, it's not a bad thing to do.
