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. However, the script does not seem to load. I do not believe it is a syntax issue, since a similar script works on a different site. However, I cannot figure out what is different here. When looking at the inserted script in chrome inspector, inside of the script seems to be just plain text (not colored javascript code). Is there something I can do to fix this and make the script run?

Link to the page: http://memories.uvaphotography.com/home/services/

Read More

Javascript code I am trying to insert:

<script>
$("#reply-title").hide();
</script>

Related posts

Leave a Reply

2 comments

  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.

  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.