I'm looking for a way to delete ' '
from my html code, found number of ways on stackoverflow.com, but neither of those seam to work!
HTML
<p>No Space</p>
<p> 1 Space</p>
<p> 2 Spaces</p>
<p> 3 Spaces</p>
<p> 4 Spaces</p>
jQuery
$(document).ready(function() {
$('p').text().replace(/ /g, '');
//$('p').html($(this).html().replace(/ /gi,''));
});
jsfiddle - playground http://jsfiddle.net/MrTest/hbvjQ/85/
You have   in your code instead of
$('p').each(function(){
$(this).html($(this).html().replace(/ /gi,''));
});
http://jsfiddle.net/genesis/hbvjQ/76/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With