if(typeof(myVar) !== 'undefined');
Solution source: http://quomon.com/question-how-to-check-if-a-javascript-variable-is-defined-891.aspx
To get all properties of a Javascript/jQuery object (to find what methods and values can be set for example) use the following function:
var getKeys = function(obj){
var keys = [];
for(var key in obj){
keys.push(key);
}
return keys;
}
Or to list them in Firebug:
for(var key in obj){
console.log(key);
}
Solution source: http://stackoverflow.com/questions/208016/how-to-list-the-properties-of-a-javascript-object
No comments:
Post a Comment