Creating String without Line Breaks

String without Line Breaks

by Shrikrishna Gupta

HTML

<script src="https://code.jquery.com/jquery-2.2.3.js"></script>
<div>
Some test
no linebreaks
</div>
<button type="button" id="clickeve" >Click Me!</button>

<div class="white-space-pre">
Some test
sddsada
sda
da
d
ad
sdasdsadad
ad
asd
with linebreaks
</div>

JavaScript

$(document).ready(function(){

$("#clickeve").on("click",function(){
$(".white-space-pre").replace(/^(.+)$(\r\n|\n|\r){1}^(.+)$/gm, " ");

})

});