tags in the div and add additional
to each How can I use jQuery to find all
tags in a div with a post message and ...">

JQuery find <br/ "> tags in the div and add additional <br/"> to each

How can I use jQuery to find all <br/> tags in a div with a post message and add an extra <br/> tag after each?

+4
source share
2 answers

Just guessing here, but I would try using an after function like this

 $('div.post br').after('<br/>'); 
+7
source

Try something like this:

 $('div.post br').each(function() { $(this).after($(document.createElement('br'))); }); 

But as a tip, you should avoid using the <br /> tags in the <div> . Formatting must be done using CSS, for example, you can add margin-after to your div to have the same result.

0
source

Source: https://habr.com/ru/post/1343072/


All Articles