Hello folks,
I am refining a plugin for public distribution. Presently I am trying to implement client-side validation through jQuery, but for some reason I cannot load jQuery itself.
This part of the plugin is in a custom admin page. I tried some simple jQuery code; to be on the safe side, I used a no-conflict function.
function test_js() {
wp_enqueue_script('jquery');
?>
<script type="text/javascript">
$j=jQuery.noConflict();
$j(document).ready(function() {
$j("div.debug").hide();
});
</script>
<?php
}
add_action('admin_print_scripts','test_js');
Firebug returns "jQuery is not defined". Yet jQuery is correctly loaded, as the HTML code shows:
<script type='text/javascript' src='http://pattybook.local/~davidebenini/lucianacorsi/wp-includes/js/jquery/jquery.js?ver=1.2.3'></script>
<script type='text/javascript' src='http://pattybook.local/~davidebenini/lucianacorsi/wp-admin/js/common.js?ver=20080318'></script>
<script type='text/javascript' src='http://pattybook.local/~davidebenini/lucianacorsi/wp-includes/js/jquery/jquery.color.js?ver=2.0-4561'></script>
This code gets inserted after my script's code, is that a problem?
Anyway, jQuery doesn't work even from the Firebug console; eveything seems to indicate that it is not loaded, but it is.
Any suggestion?
Davide