/ Published in: jQuery
Simple snippet to return the keys of an object.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$.extend({ keys: function(obj){ var a = []; $.each(obj, function(k){ a.push(k) }); return a; } }) // Useage: var obj = {a: 1, b: 2, c: 3, d: 4, kitty: 'cat'} alert($.keys(obj)); // a,b,c,d,kitty
URL: http://groups.google.com/group/jquery-en/browse_thread/thread/3d35ff16671f87a2\