Jump to content

NEed help escaping string with dynamic variable


djones

Recommended Posts

The problem is I keep getting "Missing ) after argument list". I know why but I've tried all I can to prevent this from happening. The problem var, descr, is a description that could be "Bob's $50 ticket". I know how to escape the 's but I'm not sure how to clear the rest...

 

button_id is a variable

$(button_id).innerHTML = '<a href="#" onclick="add_cart(\''+gift_item_id+'\',\''+descr+'\',\''+amount+'\',\''+button_id+'\');"><img src="/images/add_cart.jpg" border="0" style="margin: 4px 0 0 0"  /></a>';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.