The line 13 in the code below attempts to reset an onclick event first to null and then on line 14, attempts to set it to another action, however, it's ineffective and how to do it? Thanks.
Line 1: var config = function() {
Line 2:
// display config / usage info but no dupe display
Line 3:
if (!document.getElementById('confinfo')) {
Line 4:
var i = document.createElement('info');
Line 5:
i.id = "confinfo";
Line 6:
i.style = "color:green";
Line 7:
i.innerHTML = conf.usage;
Line 8:
document.body.insertBefore(i,document.body.firstChild);
Line 9:
Line 10:
// hide the config / usage info to free up the real estate
Line 11:
var h = document.getElementById('usage').value = "Hide config / usage instructions";
Line 12:
console.log('from top section: ' +h);
Line 13:
h.onclick = null;
Line 14:
h.onclick = function () {
Line 15:
console.log('hide clicked');
Line 16:
// document.getElementById('confinfo').style.display = "none";
Line 17:
document.getElementById('confinfo').innerHTML = '';
Line 18:
}
Line 19:
}
Line 20: }