If you are using jQuery:
$('.myClass').click(function() {
$(this).next().remove();
$(this).remove();
});
If plain javascript:
var spans = document.getElementsByClassName('myClass');
for(var i = 0; i < spans.length; i++) {
spans[i].onclick = function() {
this.parentNode.removeChild(this.nextSibling);
this.parentNode.removeChild(this);
};
}