Javascript Check If Object Is Valid

Checks if an object exists in the document using Javascript.

function isValidObject(objToTest) {
  if (null == objToTest) return false;
  if ("undefined" == typeof(objToTest)) return false;
  return true;
}
No TweetBacks yet. (Be the first to Tweet this post)

Like what you see? Buy me a cup of coffee. Or subscribe to my feeds.


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

2 Responses to “Javascript Check If Object Is Valid”

  1. 1
    Ester's Daily Thoughts Says:

    I totally forgot all these codes. It’s good to be reminded. These computer languages are nothing once you never used it for a long time.

    Ester’s Money Journal
    Concealed Mind

  2. 2
    tech Says:

    true. i actually post the methods and functions that are quite handy to me so that i don’t have to search through the net just to find it. i can just go over to my blog here and look for it quickly. kodigo ;)

Leave a Reply