Skip to content Skip to sidebar Skip to footer

Javascript Not Loading Wordpress Footer

I recently started learning Javascript. I am trying to add a small script to the footer of a page on my Wordpress site. I am using the 'insert headers and footers' plugin. Howev

Solution 1:

jQuery in WordPress runs in noConflict mode which means the global $ shortcut for jQuery isn't available. Replace your code with the following:

<script>
    jQuery(document).ready(function($) {
        $("#reply-title").hide();
    });
</script>

Inside the document ready wrapper the $ can be used as an alias for jQuery.


Solution 2:

The reason that you're not seeing your script execute is because jQuery isn't assigned to the $ variable.

When viewing the element inspector console on your page there's a javascript error

Uncaught TypeError: undefined is not a function

When I run the same script via console replacing $ with jQuery the #reply-title is hidden successfully.


Post a Comment for "Javascript Not Loading Wordpress Footer"