'How can we escape all double quotes in prestashop?

I'm using prestashop as a cms and i want to display specific products on a page.

I found a module to do so by writing for example this line of code : [ph-product-cms id="1"] which will be converted at the execution into many lines of code with multiple quotes to display the products

The thing is when i try to use innerhtml like this : document.getElementsByClassName('test0 prod')[0].innerHTML = "[ph-product-cms id="1"]"; it shows Uncaught SyntaxError : Unexpected identifier

this is from the console of the browser

I tried single quotes but it doesn't work either.



Solution 1:[1]

Wherever you find double-quotes put a \ before them to escape them. For example,

\[ph-product-cms id=\"1\"]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Syed Mohammad Sannan