I think there is a conflict with the way WordPress uses jQuery:
Tried:
(function($) {
$(document).ready(function(){
alert('hello');
});
}(jQuery));
Tried also:
$(document).ready(function(){
alert('hello');
});
And Firebug dumps:
jQuery is not defined
[Detener en este error] }(jQuery));
And also tried:
jQuery.noConflict();
jQuery(document).ready(function($) {
alert("hello");
});
and Firebug:
jQuery is not defined
[Detener en este error] jQuery.noConflict();
And jQuery is imported
Any idea what am i missing?
It looks like jQuery is not available (neither the
$
variable norjQuery
were defined). In your particular case, it’s because the library is not loaded at all. Put the next code in your<head>
section before your the scripts requiring jQuery:How are you including jquery? Whatever the case may be, its not happening (check out the head / check out the page DOM via firebug – no $ or jQuery references).
The correct way to link the hosted version of jquery (and in this case, a dependent plugin) in wordpress looks like this:
in functions.php (or a plugin… or whatever)
To ensure wordpress delivers the correct scripts at the correct time, you must add actions to the init and register script wordpress methods.
Hope that helps
even if your document works now, for better practive :
for example in your code :
should be
and
should be
your code is semantic , where header is not a tag, but a tag , meaning header is not a class or id (rather #branding is an id ) and body as well (rather .home or .blog)
better practice would be to declare the class .
Checked the URL you have posted and there seems to be no reference to jQuery.
Include the below code inside head
Try putting this code in
<head>