Moving from Prototype/Scriptaculous to JQuery

Recently I had to do the migration of some javascript code written using Prototype and Scriptaculous to JQuery. The process wasn’t straightforward but wasn’t very difficult either. I jotted down a bunch of differences I had to deal with and thought of putting them together here.

Feature Prototype/Scriptaculous JQuery
ID Selector id #id
appending a node appendChild append
cloning array Array.clone Array.slice
Setting css style values elem.style.prop=value elem.css(prop,value)
Getting parent node elem.parentNode elem.parent()
Utility methods for an element Element.Methods.getHeight for example elem.height()
Removing a node node.parentNode.removeChild(node) node.remove()
Advertisements

1 Comment

Filed under JQuery

One response to “Moving from Prototype/Scriptaculous to JQuery

  1. What i do nott realize is in reality how you are no longer really a lot
    more smartly-preferred than you may be now.

    You’re soo intelligent. You understand thus considerably in relation to thi subject, made me personally consider it
    from a lot off various angles. Its like women and men are not involved
    unless it is something to accomplish ith Lady gaga! Your personal stuffs
    nice. Alll the time care for it up!

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s