I have html div with one attribute.
div exp_attribute="{"prop_val_name":1}">mydiv</div>
I tried to trigger click on it via jQuery like
$('div[exp_attribute={"prop_val_name":1}]').click(); // not working $('div[exp_attribute=\{"prop_val_name":1\}]').click(); // not working with escaping special chars $('div[exp_attribute=\{\"prop_val_name\":1\}]').click(); // not working with escaping more special chars
but keep getting error
Error: Syntax error, unrecognized expression: div[exp_attribute={"prop_val_name":1}]
so any idea how to handle the issue?
Advertisement
Answer
Better to escape everything
$('div[exp_attribute=\{\"prop_val_name\"\:1\}]').click();