Thursday, January 24, 2019

Make a jQuery function file available globally

File 1: global function isMobile
jQuery(document).ready(function($){
  window.isMobile = function () {
  // your function logic goes here
  };
});
File 2: call the function
jQuery(document).ready(function($){
  var mobile = isMobile();
  console.log(mobile);
});

No comments:

Post a Comment