Posts

Showing posts from July 18, 2010

Why I moved from Prototype to jQuery

jQuery  is a JavaScript library which follows unobtrusive paradigm for application development using JavaScript. jQuery inherently supports Behavior driven development and is based on traversing HTML documents using CSS Selectors. On the other hand,  Prototype  is a JavaScript library for Class driven development which makes life easier working with JavaScript. Prototype library has a good support in Ruby on Rails via helper functions. I have always used Prototype library for most of my projects until I was introduced to jQuery three months back ... and it enchanted me. The reasons Behavior driven development (BDD) Using jQuery, behavior(s) of HTML elements is defined separately from HTML code similar to defining style of an element using CSS. Lets look at a  simple example  to display alert box on click of an element 1 2 3 4 5 6 $(element).click( function (){ alert ( " warning " ); //fill stub for confirming this action from user }); A complex example : Al