[wp-hackers] Re: wp_enqueue_script Question

DD32 wordpress at dd32.id.au
Fri Mar 28 03:58:42 GMT 2008


jQuery in WordPress uses the noConflict option to prevent issues with  
Prototype.

You need to use jQuery(document)... or one of the other fancy functions  
such as this:

function($){
$(document)..
}(jQuery);
(I think thats how you do it.. Check online for jQuery.noConflict())


On Fri, 28 Mar 2008 14:43:44 +1100, Chris Poteet <cpoteet at siolon.com>  
wrote:

> Now that I have jQuery loaded for some reason I'm having problems
> initializing jQuery.  I have no idea why.  Below is the code I use and
> the error I get.  I am sure jQuery is indeed being loaded correctly.
>
> add_action('wp_head', 'postinfo_head');
>
> function postinfo_head() {
>  	echo "...stylesheet...";
> ?>
> <script type="text/javascript">
> 	 $(document).ready(function() {
> 		$(".open-post-info").click(function() {
>   			$(".post-info").show("medium");
>   			return false;
> 		});
> 	});
> </script>
> <?php }
>
> But Firebug tells me...
>
> $ is not a function
> [Break on this error] $(document).ready(function() {
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>




More information about the wp-hackers mailing list