Try: Object.prototype.getKeys = function(){ var arr = []; $.each(this, function(k){ arr.push(k) }); return arr; }
On Thu, Dec 11, 2008 at 2:17 PM, Bill <bllfr...@gmail.com> wrote: > > If you know of another way of accomplishing this using jQuery, please > let me know! > > On Dec 11, 11:12 am, Bill <bllfr...@gmail.com> wrote: > > Hi all, > > > > I extended the Object object with a method called getKeys() that works > > like Perl's keys() function -- given a hash, or associative array, the > > method returns an array containing all keys: > > > > Object.prototype.getKeys = function() { > > var arr = new Array(); > > for (var s in this) { > > if (this.hasOwnProperty(s)) arr.push(s); > > } > > return arr; > > > > } > > > > However, when I include this function definition anywhere in a page, > > jQuery reports the following error: > > > > name.replace is not a function > > name = name.replace(/-([a-z])/ig, function(all, letter) > > { jquery-1.2.6.js (line 1115) > > > > Any idea why this might be happening? > > > > Thank you kindly, > > > > --Bill > -- Eric Garside Front End Developer LabPrints