• Hello everyone!

    I am trying to use the jQuery Brackets library in my website and I just can’t seem to make it work. I’ll go through the steps i have taken:

    • I have uploaded the library to the server and included it using the wp_enqueue_script() in my functions.php
    • Tried some simple test codes from the library page by paste-ing it in a new page, under the “text” section of the editor:
      <script type="text/javascript">
      var minimalData = {
          teams : [
            ["Team 1", "Team 2"], /* first matchup */
            ["Team 3", "Team 4"]  /* second matchup */
          ],
          results : [
            [[1,2], [3,4]],       /* first round */
            [[4,6], [2,1]]        /* second round */
          ]
        }
      
      $(function() {
          $('#minimal .demo').bracket({
            init: minimalData /* data to initialize the bracket with */ })
        })
      </script>

      This gave me the “$ is not a function error”

    • Replaced the $ with jQuery, and passed $ as argument to the anonymous function — now nothing happens, and it seems the code is never run — the debugger passes right over it.

    I am a beginner with jQuery/javascript, and have no idea what is going on. The library seems to be loaded correctly. If you have any idea about how I can make it work, I would be very grateful.
    Thank you very much!
    Andrew

Viewing 1 replies (of 1 total)
  • Try to change the anonymous function to wait with execution until the document is ready:

    jQuery(document).ready(function ($) {
        $('#minimal .demo').bracket({ init: minimalData /* data to initialize the bracket with */ })
    })
Viewing 1 replies (of 1 total)
  • The topic ‘jQuery Brackets Library in WordPress Page issues’ is closed to new replies.