Iladarsda Iladarsda - 2 years ago 171
jQuery Question

Remove ' ' - still trying

Still looking for a way to delete

' '
from my html code, found number of ways on, but neither of those seam to work!


<p>No Space</p>
<p>&nbsp1 Space</p>
<p>&nbsp&nbsp2 Spaces</p>
<p>&nbsp&nbsp&nbsp3 Spaces</p>
<p>&nbsp&nbsp&nbsp&nbsp4 Spaces</p>


$(document).ready(function() {

$('p').text().replace(/ /g, '');


jsfiddle - playground

Any help much appreciated.


Answer Source

You have &nbsp in your code instead of &nbsp;


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download