How To Access Liquid Objects With JavaScript / JQuery

Hello,

It may be easy to answer my question, but I haven’t found a solution after searching and trying things for hours now. So this is what I would like to do:
change the link of an object from a link that is who on the description part of a product .
After doing, the description breakdown, the link exists in {{product_desc_array[14]}}.
but when i want to access it with javascript, it doesn’t work.

document.getElementById(‘fileProduct’).setAttribute(‘href’, ‘{{product_desc_array[14]}}’);

How can I access liquid objects with JQuery and, for example, store them in a JS variable?

kind regards,

Hi @Nessek ,

You need to add the code at the place where ‘{{product_desc_array[14]}}’ shows. Because I checked and your javascript code is correct.

So it may be in the file you added the javascript code is not correct.

Hope it helps!