Akhil Paul Akhil Paul - 3 months ago 6
jQuery Question

Is it possible to remove '&nbsp' using JQuery..?

I have two buttons in a row and they are shown in two td's, and its not lined up correctly in IE, I doubt that hidden spaces(&nbsp) in the td's somewhere mayby after the input or before the input button, unfortunately I cant access the html code, its automatically generated. The only way is to control by using jQuery I have a jQuery something like this..

$("td:contains(' ')").css("display", "none");

Is this a right way to get rid of that &nbsp in the td ..?

I dont have huge knowledge in JQuery though..


Akhil Paul


No, you would do something along these lines:

$("td").each(function() {
    var $this = $(this);
    $this.html($this.html().replace(/ /g, ''));