
JQuery is getting more and more popular, many people are using JQuery in WordPress. The right way to import JQuery to your WordPress is like this:
< ?php wp_enqueue_script(“jquery”); ? >
Rather than using <script> syntax. Remember to run this script before wp_head(). And then you can load your own JavaScript like this:
< script type=”text/javascript”
src=”< ?php bloginfo("template_url"); ? >/js/testScript.js” >< /script>
Also remember you must put this after wp_head().
I recently learn one more thing from Chris Coyier from DigWP, a simple way to prevent JQuery to conflict with other JavaScript libraries. Which is to set JQuery to “no conflict” mode and use “$j” instead of “$”:
var $j = jQuery.noConflict();
$j(function(){
do something.
}
Feel free to visit our Forum, subscribe our RRS Feed for news updates, and follow us on Twitter.
Pingback: Video Plus - Embed Videos from Popular Web Hosts | Page 29 | Pligg CMS Forum