Javascript examples for jQuery Method and Property:jQuery Method Example
put the next word onto a new line If a word as a space
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(window).load(function(){/*from w w w .j av a2 s. co m*/ $(".hero_text").html(function(index, text) { return text.replace(' ', '<br>'); }); }); </script> </head> <body> <div class="hero_text"> Screen Shot </div> </body> </html>