jQuery / JavaScript - 在两个元素之间修剪空格/制表符?
问题描述:
Possible Duplicate:
Remove non breaking space ( ) from between elements using jquery
如何编写脚本来修剪两个元素之间的空格/制表符?
例如,
How to write a script to trim white space/tab between two element?
For example,
<tr> <td>A </td> <td>B </td> <td>C </td> </tr>
转换为,
<tr><td>A </td><td>B </td><td>C </td></tr>
例如,脚本应删除第一个之间的空格/制表符< td> xxx< / td>
元素和第二个< td> xxx< / td>
元素等等。
For the example, the script should remove the white space/tab between first <td>xxx</td>
element and second <td>xxx</td>
element and so on.
谢谢
答
使用:
function specialTrim(str){
return str.replace(/>\s+</g,'><');
}