• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 jQuery in a page node

abdfahim

Active member
#1
Pretty sure I am missing something silly, but why my XF1 page node consists of plain HTML and jQuery is not working with XF2? It says couldn't load jQuery. Do I need to add jQuery separately?

Code:
<script>
    jQuery(document).ready(function(){
        ..............
    });

   <div>
      .......................
   </div>
</script>
 

Chris D

XenForo developer
Staff member
#2
Use this instead:
HTML:
<xf:js>
    jQuery(document).ready(function(){
        ..............
    });

    <div>
        .......................
    </div>
</xf:js>
That will defer the script to the footer and it will ensure it runs after jQuery has loaded.