删除所有空格和所有换行符和字符

时间:2017-06-13 05:46:41

标签: jquery

我已经尝试了几个教程,但无法正常工作。我想删除所有的html空间charactors,加上之间的行,然后删除所有换行符和任何空格。我没有权限更改html或者这会更容易

 | 

来自以下

<span class="weekly-navbar"><span class="reportnavigationheader">Select Week: </span><span class="currentweek">1</span>
&nbsp;|&nbsp;<a href="#">2</a>
&nbsp;|&nbsp;<a href="#">3</a>
&nbsp;|&nbsp;<a href="#">4</a>
&nbsp;|&nbsp;<a href="#">5</a>
&nbsp;|&nbsp;<a href="#">6</a>
&nbsp;|&nbsp;<a href="#">7</a>
&nbsp;|&nbsp;<a href="#">8</a>
&nbsp;|&nbsp;<a href="#">9</a>
&nbsp;|&nbsp;<a href="#">10</a>
&nbsp;|&nbsp;<a href="#">11</a>
&nbsp;|&nbsp;<a href="#">12</a>
&nbsp;|&nbsp;<a href="#">13</a>
&nbsp;|&nbsp;<a href="#">14</a>
&nbsp;|&nbsp;<a href="#">15</a>
&nbsp;|&nbsp;<a href="#">16</a>
&nbsp;|&nbsp;<a href="#">17</a>
&nbsp;|&nbsp;<a href="#">18</a>
</span>

所以html在完成时看起来像这样

<span class="weekly-navbar"><span class="reportnavigationheader">Select Week: </span><span class="currentweek">1</span><a href="#">2</a><a href="#">3</a><a href="#">4</a><a href="#">5</a><a href="#">6</a><a href="#">7</a><a href="#">8</a><a href="#">9</a><a href="#">10</a><a href="#">11</a><a href="#">12</a><a href="#">13</a><a href="#">14</a><a href="#">15</a><a href="#">16</a><a href="#">17</a><a href="#">18</a></span>

1 个答案:

答案 0 :(得分:0)

我强烈建议您使用此HTML minifier框架