My Software Notes

Useful things I discover

I love jQuery

leave a comment »

JavaScript in a browser is a pain.  There is no getting around it.  It’s flaky, unreliable and its implementation varies from browser to browser.  

I am not a power JavaScript programmer, I use it when I need it on web pages, but I’m starting to need client scripting more and more, so I have to use JavaScript more and more.  Yuck!

I have a couple of books on it and I do GDD like most of us to quickly find out how to do something.  But I often find with JavaScript that a script doesn’t always work.

For example: stop the Enter key from submitting a form.  An apparently simple piece of JavaScript that you will find all over the web and yet the simple script I was using and that had worked for a year suddenly stopped working in Firefox.

I tweaked it and varied it and found other ways to do it and they all worked in IE and they all failed in Firefox.  With no explanation, no error message, no nothing.  It just silently failed.

I’d added that JavaScript to the site before I’d gotten familiar with jQuery and it was a really simple script for goodness sake, so I didn’t turn to jQuery immediately.  But after I’d torn out some of my precious hair I decided to dump plain old JavaScript and go with JQuery.  I added a link to one of the CDNs, spun up some simple jQuery and voila! It worked first time and in every browser I tested.

And then today I had to write something to make a set of checkboxes uncheck if the user checked the “None of the above” checkbox and uncheck the “None of the above” checkbox if they checked any of the others.  And it worked easily with minimal debugging (basically some typos on my part).

So, I will state unequivocally that jQuery rocks and I love it.


Written by gsdwriter

August 31, 2010 at 3:39 pm

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: