Virajsinh

jQuery Check if Function Exists Example

Jul 6th, 2020
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.26 KB | None | 0 0
  1.     function somenoobfunction() {
  2.     }  
  3.  
  4.     // using jQuery
  5.     if ($.isFunction(window.somenoobfunction)) {
  6.         //execute it
  7.         somenoobfunction();
  8.     } else {
  9.         //doesnt exists... cry?!?
  10.         document.writeln('somenoobfunction does not exist');
  11.     }
Add Comment
Please, Sign In to add comment