I've utilized JavaScript to generate a button. Now, I'm wondering how to incorporate an onclick
event for this button.
var b1 = document.createElement("button");
b1.setAttribute("class", "btn btn-default");
b1.setAttribute("id", "viewdetails");
b1.innerHTML = "View Details";
d3.appendChild(b1);