Return to Snippet

Revision: 41593
at February 20, 2011 21:24 by jonern


Initial Code
$.fn.equals = function(compareTo) { 
        if (!compareTo || !compareTo.length || this.length!=compareTo.length) 
{ 
                return false; 
        } 
        for (var i=0; i<this.length; i++) { 
                if (this[i]!==compareTo[i]) { 
                        return false; 
                } 
        } 
        return true; 
}

/* USAGE: element.equals(target);

Initial URL

                                

Initial Description

                                

Initial Title
Compare Objects in jQuery/javascript

Initial Tags

                                

Initial Language
JavaScript