<span style="font-size:14px;">这是jQuery的简单封装,在函数里怎么写,都可以</span>
<span style="font-size:14px;">调用也很简单 </span>
<span style="font-size:14px;">$.ltrim();</span>
<span style="font-size:14px;">$(obj).rtrim(); </span>
<span style="font-size:14px;"></span>
<span style="font-size:14px;"> $(function () { (function ($) { $.fn.extend({ ltrim: function (txt) { return txt.replace(/^\s*/g, ""); }, rtrim: function (txt) { return txt.replace(/\s*$/g, ""); } }); })(jQuery);<span style="white-space:pre"></span>);</span>