d1 = document.getElementById("d1");
b1 = document.getElementById("b1");
var done = new Event('done');
d1.addEventListener('done', function(){d1.innerHTML = Math.random()});
b1.addEventListener("click",
function(){
//b1.innerHTML = Math.random();
b1.dispatchEvent(done);
});
b1.addEventListener('done', function(){
d1.dispatchEvent(done);
});
var radioButton = document.createElement('input');
radioButton.setAttribute('type','radio');
var text = document.createTextNode("testing daddy");
document.body.appendChild(radioButton);
radioButton.addEventListener('click', function(){
document.body.appendChild(text);}, false);
var radioButton2 = document.createElement('input');
radioButton2.setAttribute('type', 'radio');
var text2 = document.createTextNode("second test");
document.body.appendChild(radioButton2);
radioButton.addEventListener('onclick', function(){document.body.appendChild(text2);}, false);
<div id="d1"></div>
<button id="b1">button</button>
<p>"click" works but only for the first click with a radio button</p>
<p> "onclick" does not work. </p>