Forum Discussion

kbulens's avatar
kbulens
Guide
11 years ago

jQuery is undefined

<script> (function($){ console.log('ok'); jQuery('body').addClass('fr'); })(LITHIUM.jQuery); </script>    I added the above code in my header section, cause depending on language, i want to ad...
  • PaoloT's avatar
    11 years ago

    Hi kbulens 

     

    If you want to use the jQuery provided by Lithium, I suggest to use the liaAddScript directive that we have to ensure that your script is executed once jQuery has been included on the page. Your code would change to :

     

    <@liaAddScript>
    ;(function($){
    console.log('ok');
    $('body').addClass('fr');
    })(LITHIUM.jQuery);
    </@liaAddScript>

     Hope this helps,