Category Archives: Javascript

December 7, 2010
Adding Prototype methods to jQuery

We recently upgraded a project which was using the Prototype JavaScript framework to use jQuery and ran into a few methods which didn’t exist in jQuery at all. A quick search gave us an easy solution; by adding a prototype property (not related to the Prototype framework) to String.prototype we can give every `string` in [...]

October 28, 2009
Extracting URL variables using JavaScript

Server side languages are cool in that they give you a nice associative array to access URL variables. ColdFusion has the URL scope, PHP has $_GET[] etc, but how do you get these values easily with JavaScript? I came across a post over at Jake Munson’s blog which had just what I needed. Actually although [...]

June 15, 2009
Prototype/scriptaculous issue with Sortable.create()

I’ve been doing some custom sorting within FarCry using the prototype/scriptaculous libraries as they already exist in the FarCry framework by default. I was having trouble getting the Sortable.create() to work properly and the main docs site for scriptaculous seems severely lacking in examples. Basically the “sorting” action was happening fine but no event was [...]

March 11, 2008
Passing extra parameters to Prototype observer handlers

Another tip from my Prototype travels… ‘Observers’ let you create a listener for a user event, for example on a form submission you may want to run some client side validation before actually submitting the form. Of course you can add ‘onsubmit()’ in your <form> tag, but isn’t it much nicer to keep your markup [...]

March 10, 2008
Showing and hiding elements with CSS and JavaScript

* Note: These examples reference the Prototype JavaScript framework. Often I find that I want to load content onto a page but have its default view state as hidden until a user defined event makes it appear. The problem is if I hide an element using a linked CSS file (with a class or Id [...]