p.onclick = function (event) { var e = event || window.event, target = e.target ? e.target : e.srcElement; if (target.tagName === 'SPAN') { p.removeChild(target); } }