• Resolved mine2learn

    (@mine2learn)


    I am fairly new to jQuery and I am having trouble to have it work consistently. Here is the simple example that’s not working:

    HTML:

    <p>If you click on the "Hide" button, I will disappear.</p>
    <button id="hide">Hide</button>

    My JS script:

    jQuery(document).ready(function($){
      $("#hide").click(function(){
        $("p").hide();
      });
    });

    I checked in the source that both the jQuery script and my own script are referenced (the 2 jQuery lines by default and my script by using wp_enqueue_script()):

    <script type='text/javascript' src='http://www.mine2learn.com/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>
    <script type='text/javascript' src='http://www.mine2learn.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
    <script type='text/javascript' src='http://www.mine2learn.com/wp-content/themes/twentythirteen/js/test_alt.js?ver=3.7.1'></script>

    If I click the hide button, nothing happens. “Normal” JS functions in the same script work, so I know that the reference to this script is working, but not any jQuery.

    At some point in the past, I already had jQuery working, but I don’t know what’s different know. Can anyone help and point me in a direction where to dig? I’m out of ideas.

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Problems with jQuery’ is closed to new replies.