Support » How-To and Troubleshooting » Why jQuery doesn’t work as it should?

Why jQuery doesn’t work as it should?

  • Hi!

    I have some custom jQuery functions in my blog, to run them, I need to include standard jQuery library. Why the library, which comes with WordPress doesn’t run these standard functions?

    here are some examples of my functions:

    <script type="text/javascript">
    	$('#show').click(function() {
    	  $("#front-list").animate({ width:"590px" }, 1500 );
    	  $("#content").animate({ width:"590px" }, 1500 );
    	 $('.post-ratings').append("<span class='post-ratings-text'><br />Blaa blaa</span>");

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi


    Forum Moderator

    thanks, esmi! You helped me again 🙂

    But I don’t understand how my code has to be modified. Can you please help me?

    Try like this. Reduce conflict and runs the jquery only after the page is finished and the elements exist to be manipulated.

    <script type="text/javascript">
         var $j = jQuery.noConflict();
         // Use jQuery via $j(...) instead of $(..)
           $j('#show').click(function() {


    Forum Moderator

    As darrellonsite said, you need to look at jQuery noConflict wrappers. The explanation and workaround are near the bottom of the wp_enqueue_script Codex page.

    thanks again!

    I found a solution myself 🙂
    I just had to replace $ with jQuery and put <?php wp_head(); ?> before script.

    Is there any reason now to run script the way darrellonsite said?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Why jQuery doesn’t work as it should?’ is closed to new replies.
Skip to toolbar