Blog

Document Ready Substitute to Make Custom jQuery Execute in WordPress
Posted on March 16, 2015 in JavaScript, jQuery, WordPress by Matt Jennings

To make custom jQuery execute in WordPress (at least 4 and above), in your external JS file add the code below:

// Start Anonymous Function
(function() {


  /* WordPress-specific jQuery instead of Standard Document Ready or
  *  Shorthand Document Ready
  */
  jQuery(document).ready(function($) {

    
    // Write jQuery here
  

  //End jQuery
  });

// End and Call Anonymous Function
})();

Leave a Reply

To Top ↑