Reputation: 81
I've added a simple span element before an anchor element. I want to remove this span later (no id on either element btw). I'm using mootools 2.x (and my jQuery chops don't seem to be helping much here)
I assumed a simple $(this).prev().remove() would work but not with mootools - anyone help?
the html looks something like this
<span>fail</span><a href="#" onclick="...">link</a>
Upvotes: 2
Views: 5008
Reputation: 26165
within the click handler callback - and don't use onclick, use element.addEvent("click", function() {});
instead:
remove totally:
this.getPrevious().destroy();
detatch from dom:
this.getPrevious().dispose();
Upvotes: 5