js/jquery去掉空格,回车,换行示例代码_jquery

WBOY
Release: 2016-05-16 17:17:34
Original
1270 people have browsed it

Jquery:
$("#accuracy").val($("#accuracy").val().replace(/\ +/g,""));//去掉空格

.replace(/\ +/g,"") //去掉空格方法
$("#content").val($("#content").val().replace(/[ ]/g,"")); //去掉空格

.replace(/[ ]/g,"")//去掉空格
$("#content").val($("#content").val().replace(/[\r\n]/g,""));//去掉回车换行

.replace(/[\r\n]/g,"")//去掉回车换行

.replace(/-/g, '') //去掉"-"号

js:

var testStr="sssss

vvvvv";
var resultStr=testStr.replace(/\ +/g,"");//去掉空格

resultStr=testStr.replace(/[ ]/g,""); //去掉空格

resultStr=testStr.replace(/[\r\n]/g,""));//去掉回车换行

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!