Why is my Simple jQuery Function not Defined?

I’m very new to jQuery, and I would like some insight on how to make this very simple jQuery function something that can actually execute. I am trying to apply jQuery to WordPress, hence is why my code begins with “jQuery” rather than the standard “$”. The task I wish to accomplish with this little test function is simply append the word “test” to the end of a block of test, but as it stands my function is returning a ” Uncaught ReferenceError: test is not defined” error. The code I’m trying to execute is fully shown below:

jQuery(function () {
    function test() {
        $( ".about-us" ).append( "<p>Test</p>" );

And this is how I’m calling said script on my page (at the very bottom):

<script type="text/javascript" src="/mysite/wp-
<script type="text/javascript">

Any insights that could help enlighten me on how to solve this and future conundrums would be greatly appreciated.

Read more here: Why is my Simple jQuery Function not Defined?

Leave a Reply

Your email address will not be published. Required fields are marked *