Tips / Recommendations

Fixing the Common jQuery Error in WordPress

wp_enqueue_script( 'tt-mobile-menu', get_template_directory_uri() .

'/js/mobile-menu.js', array('jquery'), '1.0', true );

jQuery(document).ready(function()

{

jQuery(#selector) ...

});

(function($) {

// Use $() inside of this function

$(#selector) ...

})(jQuery);
<script src="http://code.jquery.com/jquery-1.11.2.min.js" type="text/javascript"></script>

Leave a Reply

Your email address will not be published.

20 − 12 =