Use jQuery To Bring Your Site To Life
If you're not using a Javascript framework, you are writing too much code! When I first started learning how to write Javascript several years ago, I didn't know these frameworks existed. A couple a years ago, I learned about jQuery and how to utilize it to speed up my development.
I'm sure you're thinking that first paragraph seems like an ad. Well, that may be so, but I enjoy every minute I am able to develop code using jQuery.
Example: Alternate Background Colors in a Table
Let's start with a table layout.
To alternate background colors, the following code can be used.
-
$('#example tbody tr:odd').css('background-color','#CCCCCC');
In the above code, css selectors are used to get a handle to every other tr in the table tbody section. Then, the background color is applied to every other table row. Only one line of Javascript code is needed to accomplish this!
To learn more, visit the jQuery website.


Post comments