I encountered a small issue on javascript while doing a small hack for a VBulletin plugin. Sometimes a javascript function was included, sometimes not.
So I needed a way to check if that function was or wasn’t defined so I can call it safely (without any error message). In case you ever need something like this .. here is the code
JAVASCRIPT
-
if(typeof functionNameToCheck == ‘function’) {
-
//you can now safely call your function
-
}
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.