I'm stuck in a problem. The onclick property for the button created inside Javascript is not working Here is my code:
Click here
Reply function: Click here
try this
var button = document.createElement('button');
button.className = 'btn btn-outlline-primary';
button.value = 'Reply';
button.setAttribute("onclick", "YOURFUNCTIONNAME()");
div.appendChild(button);
you can give your button an onclick funtion with setAttribute
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.