开发者

How to remove the previous element using mootools

开发者 https://www.devze.com 2023-03-19 05:10 出处:网络
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

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

精彩评论

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

关注公众号