Excellent Programming Tricks

Execute jQuery code in WordPress

Most of the time jQuery codes are not working properly on WordPress theme. Add two line of code at the beginning and ending in js file.

Suppose custom_excellent_programming_tricks.js is the js file and code inside would be          
(1) (function($) { 
    //alert();
})( jQuery );
(2)
jQuery(document).ready(function( $ ) { 
    // //alert();
});
(3)
(function($) {    $(document).ready(function() {       
               // alert('adaaa');       
               // Code...    });
      })( jQuery );
(4)
$(function(){
             $(document).ready(function() {
                  //alert();
                 // Code...
             });
})(jQuery);
or
(5) (function() { ...})();
or
(6) jQuery(document).ready(function( $ ) { ... });
  1. Mainly $(function(){ ........  })(jQuery); or (function() { ...})();
  2. functions.php
    1. require get_template_directory().'/inc/enqueue.php';
* If  HTML 'onclick' not working, using jQuery [ Like $( '#ept' ).on( 'click', function( event ){ ... }); ] code is better than tuning WordPress.

No comments:

Post a Comment


Authentic аnd Excellent

Website

HTML Template

Wordpress Theme

Database applications

OR

Application services?

Excellent Programming Tricks (EPT) || Iftekhar-IT || We develops the Web applications and the WordPress templates. || Excellent Programming Tricks (EPT)

© 2020 Blogger Theme by Iftekhar IT || Excellent Programming Tricks

Execllent Programming Tricks. Powered by Blogger.