We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33379
    • 110 Posts
    I have a MIGX field "height" which I reference in the MIGX Tpl like this: [[+height]] without a problem. I need to use this field value in a js script to change the CSS for each MIGX item, any suggestions as to how I reference this value from outside of the MIGX Tpls?

    Thanks - Zaphodx
      • 16551 ☆ A M B ☆
      • 54 Posts
      Is this a MODX/MIGX or a javascript-question?

      Tpl
      <div class="migx" data-height="[[+height]]">...</div>

      jQuery
      $('.migx').each(function() {
          $(this).height($(this).data('height'));
      });
        • 33379
        • 110 Posts
        Thanks for this labr1005,

        I am not using jQuery on this but will try to apply the logic to my js, which I am learning at the moment. I have used jQuery a lot but decided it's about time learnt js properly!

        Thanks - Zaphodx