Javascript Check If Object Is Valid

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading ... Loading ...

Checks if an object exists in the document using Javascript.

?View Code JAVASCRIPT
1
2
3
4
5
function isValidObject(objToTest) {
  if (null == objToTest) return false;
  if ("undefined" == typeof(objToTest)) return false;
  return true;
}

Found this post useful? Buy me a cup of coffee or help support the sponsors on the right.

Related Posts with Thumbnails