📅  最后修改于: 2022-03-11 15:03:12.248000             🧑  作者: Mango
var but = document.createElement('button');
var my_string = '123-45-lol , @%# ';
var but.setAttribute('onclick', 'my_function( " '+my_string+' " )');
// Or to use addEventListener() instead of setAttribute() ?