passing a parameter with onclick function is read as a variable when it should be read as a string
问题 Here is my issue: I am creating dynamically a button with an onclick function like this: $("#test).html('<input type="button" value="Close" onclick="remove('+param1+','+param2+');" />'); The parameters are well read but the function is not trigger, and I've got this error message: "bob is not defined" when bob is the string value of the param1. Apparently it seems that bob is read as a variable when it should be read as a string, but I don't understand why. Thanks much for your help! 回答1: