We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22840
    • 1,572 Posts
    Hi all,

    I have a custon.js file that I need to be able to alter some elements of via tv's, I've tried adding the js to a chunk and then calling that in my footer chunk but noting I do appears to work.

    Could someone let me know how to include javascript so that I can alter it with TV's please as I'm having a brain block today :/
      • 22840
      • 1,572 Posts
      Have got this working by adding The jquery to the bottom of the template but would prefer to be able to include it, Any ideas ?

      Thanks
        • 4172
        • 5,888 Posts
        this isn't possible.
        Included javascript is loaded by the browser directly, not by modx.
        As soon as you want manipulate your javascript by modx at parsing-time, you will need to add your javascript-code into modx-elements (chunks,snippets,TVs,templates)

        Of course its possible to prepare some javascript-Vars by modx and use this vars in your included javascript.
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 22840
          • 1,572 Posts
          Cheers Bruno, I'll stick with having it in the template direct in that case.

          Thanks for replying.