This should be simple - I want to use a javascript variable, 'foo' within the .attr() element as below:
$("#readreplytxt_" + msgid).attr("onClick", "readofferclose(foo)");
I've tried this:
$("#readreplytxt_" + msgid).attr("onClick", "readofferclose("+ foo")");
However no joy.
How can I make this work?
.click()?"readofferclose(" + foo + ")"But why not just apply.on("click", function() { })?"readofferclose("+ foo")".