I keep getting this error when trying to use jquery append.
Uncaught SyntaxError: missing ) after argument list
Here is my code:
$(".grid-uniform").append('<input type="checkbox" id="addToCompare-'+prod.id+'" class="addToCompare" onclick="addProductToCompare('+prod.id+','+prod.json.variants[0].id+','+prod.title+')">');
Here are the values being passed in:
addProductToCompare(1557908979773,13234446893117,Apple iPhone X - Zizo ION Triple Layered Hybrid Rugged Case with Tempered Glass, Smoke/Clear)
It looks like the 'with' in the string is getting picked up as JavaScript. It should just be a string. When I check typeof it returns string. If I swap prod.price instead of prod.title though and keep everything else the same, it works fine.