WordPress Icon Logo
me@grafxflow

Written by me@grafxflow

02 Sep, 2012

0

1,929

JQuery function not working in WordPress Post

 Question.

You have placed some JQuery function in a WordPress post but it does nothing. Yet you know the code is correct. This is the way of getting it to work.

 Answer.

In this example I want to change the text contained in a div tag, plus I am taking into consideration that jQuery has already loaded/included.

<div id="change" style="background-color: blue;">Blue div box</div>
<script language="JavaScript" type="text/javascript">
    jQuery(document).ready(function(){
        $j=jQuery.noConflict();
        $j("#change").html("My text has changed!");
    });
</script>

Add comment

Smart Search

131 Following
57 Followers

me@grafxflow

Hull, United Kingdom

I am a Full-stack Developer who also started delving into the world of UX/UI Design a few years back. I blog and tweet to hopefully share a little bit of knowledge that can help others around the web. Thanks for stopping by!

Follow