开发者

How to remove the previous element using mootools

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()开发者_StackOverflow中文版 would work but not with mootools - anyone help?

the html looks something like this

<span>fail</span><a href="#" onclick="...">link</a>


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();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜