Problem including jQuery
-
I’m having problems including my own jQuery on a page. Basically, I have an image map, and when regions are mousedover, I want to change the text contents of a div. This works fine outside WordPress.
I believe I’ve called the script correctly:
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11); function my_jquery_enqueue() { wp_deregister_script('jquery'); wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://www.mydomain.com/scripts/the-script.js", false, null); wp_enqueue_script('jquery'); }and indeed it is loading, but it won’t execute.
The script is:
$(document).ready(function( $ ) { $("#ignition").mouseover(function() { $("#label-container").html("Ignition switch"); }); $("#ignition").mouseout(function() { $("#label-container").html("Point your mouse over the above picture for an explanation about what everything does!"); }); });Any reasons why this wouldn’t work? I’ve read various pages about not using $, and using jQuery, but I’m a little confused.
Any help would be appreciated.
Apologies I can’t link to page in questions, it’s on a closed site.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Problem including jQuery’ is closed to new replies.