本文介绍了是否可以使用 JQuery 删除“&nbsp"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我连续有两个按钮,它们显示在两个 td 中,并且在 IE 中没有正确排列,我怀疑 td 中的隐藏空格( )可能在输入之后或输入按钮之前,不幸的是我无法访问 html 代码,它是自动生成的.唯一的方法是使用 jQuery 来控制我有一个像这样的 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( ) 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");
这是摆脱 td 中的   的正确方法吗?
Is this a right way to get rid of that   in the td?
推荐答案
不,您应该按照以下方式做一些事情:
No, you would do something along these lines:
$("td").html(function (i, html) {
return html.replace(/ /g, '');
});
这篇关于是否可以使用 JQuery 删除“&nbsp"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!