palak sharma palak sharma - 1 month ago 8x
jQuery Question

how to add a line break or <br/> after every list item using jquery?

I have 100 list items and to make it look nicer i want to add a line break tag after the end of every list item. So how can I do it using javascript or jquery?


Here is a simple solution, I used insertAfter (jquery) to insert <br/> after each li


<script src=""></script>
  <li>ITEM 1</li>  
  <li>ITEM 2</li>  
  <li>ITEM 3</li>  
  <li>ITEM 4</li>  

But, you don't need JavaScript for doing this, you could do this easily by CSS

ul > li{
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
  <li>Item 4</li>
  <li>Item 5</li>