开发者

Removing a specific br tag with yui

I'm attempting to remove (or hide) a series of

tags that are nested way down inside of a bunch of divs and uls on an html page. I can't remove it from the html manually, it's wrapped up inside of a content management system and tr开发者_JAVA百科acking down where it's rendered hasn't turned up any results.

I though it would be quicker to remove them using yui (as it's loaded already). I've seen some examples on here of people adding classes or being able to identify an element by id but all I've got is the br with no class applied to it.

Ideally if I could target a specific hierarchy like div ul ul br, and get rid of that br as I don't necessarily want to remove every single br on the page.

I tried this but with no luck:

 <script language="javascript">
 var obj =document.getElementsByTagName('br');
 obj.parentNode.removeChild(obj);
 </script>

Any help would be greatly appreciated. Thanks.


See: http://jsfiddle.net/VzZVJ/

<script type='text/javascript'>
YUI().use('node', function(Y){
    Y.on('domready',function(e) {

        Y.all('div p br').remove();

    });
});
</script>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜