jquery去除字符串首尾空格的方法:$.trim()

 1 <!doctype html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>Document</title>
 6 </head>
 7 <body>
 8 <script src = "http://libs.useso.com/js/jquery/1.8.3/jquery.min.js"></script>
 9 <script>
10     var a="      x   xx     ";
11     var a = $.trim(a);
12     console.log(a)
13 </script>
14 </body>
15 </html>

 

posted @ 2015-10-09 11:01  挥刀  阅读(1591)  评论(0编辑  收藏  举报