| Author |
Falling in love with jQuery?
|
Scott Selikoff
Saloon Keeper
Joined: Oct 23, 2005
Posts: 3652
|
|
|
On the book website, it says "You'll fall in love with it when you see 20 lines of code reduced to three.". Could you give an example or two of this? The description sounds appealing but I'd like more substance. What can jQuery do that would be a huge pain to do without?
|
My Blog: Down Home Country Coding with Scott Selikoff
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
|
Event handling, Ajax, DOM manipulation and effects come immediately to mind. Especially when you factor in cross-browser issues.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
For example, here's an example I like to use. Following is some typical code to make an Ajax request, sending the value of a form field as a parameter, and shove the response text into a DOM element:
Here's the equivalent code using jQuery:
And this is a fair comparison. Both code examples work across multiple browsers that support Ajax, and both properly encode the request body.
The jQuery code actually performs some error-checking and event handling that the raw JavaScript example doesn't do.
|
 |
Scott Selikoff
Saloon Keeper
Joined: Oct 23, 2005
Posts: 3652
|
|
|
Thanks Bear, that is actually the kind of comparison that's really useful.
|
 |
 |
|
|
subject: Falling in love with jQuery?
|
|
|