archive: August 2008


jQuery > Prototype

Posted by Shane

So today I was doing some surfing online and I noticed someone was talking about jQuery. I was always interested in what jQuery was so I watched the video screencast of them using it first. jQuery is..

…a lightweight JavaScript library that emphasizes interaction between JavaScript and HTML.

After watching the screen cast, I was amazed on how little code was used versus what Prototype would use to do the same thing.

That lead me to the fact that I could use jQuery instead of a massive lines of code I was using to format the module lists (the sidebar boxs) to the right with by adding the “first” and “last” class to the first and last list (LI) elements.

So after a little reading on the jQuery tutorial site I took the plunge. After a few failed attempts I got it working perfectly. It transformed from 40 lines of code using the prototype way to now just 6 lines of code. *shock* (Click here to view the JavaScript file here on the web.)

Just so your clear on the title of this blog, JQuery is far more superier than prototype. With promots me to wonder why one of the plugins I am running is using prototype when jQuery is much better. I might add more jQuery to do more fancy stuff as jQuery has a solid user base.

Comments 1

Commenting is now closed