document.getElementById('my-id').onclick = function() { this.parentNode.innerHTML = '

A link

'; // $ Alert };