最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Find Every Instance of "<br >" in a page and remove it with jQuery - Stack Overflow

programmeradmin1浏览0评论

I'm working within a template using the Cargo Collective platform and it adds unecessary <br /> tags inside the body of my document.

How can I write a line or two of jQuery to search for every <br /> tag on my page and remove them, or replace them with nothing?

I'm working within a template using the Cargo Collective platform and it adds unecessary <br /> tags inside the body of my document.

How can I write a line or two of jQuery to search for every <br /> tag on my page and remove them, or replace them with nothing?

Share Improve this question asked Jun 1, 2013 at 6:52 Danny CooperDanny Cooper 3551 gold badge8 silver badges25 bronze badges 1
  • 2 I think you should have a look at jQuery Selectors. – user1823761 Commented Jun 1, 2013 at 6:55
Add a ment  | 

3 Answers 3

Reset to default 11

No doubt, Austins answer is perfect, but if you want, you can also use display: none;

br {
   display: none;
}

Demo

You can use the selector br and .remove(), like so.

$('br').remove();

JSFiddle

Additionally ,for in a specific div or element

#some_element br {
  display: none;
} 
发布评论

评论列表(0)

  1. 暂无评论