Js and jquery remove Spaces enter newline sample code
- 2020-03-26 23:04:33
- OfStack
Jquery:
$(" # accuracy "). Val ($(" # accuracy "). Val (.) replace (/ \ + / g, "")); // remove the Spaces
.replace(/\ +/g,"") // remove the space method
$(" # content "). Val ($(" # content "). Val (.) replace (/ [] / g, "")); // remove the Spaces
.replace(/[]/g,"")// remove Spaces
$(" # content "). Val ($(" # content "). Val (.) replace (/ \ r \ n/g, "")); // get rid of the carriage return and line feed
.replace(/[\r\n]/g,"")// replace(/[\r\n]/g,""
.replace(/-/g, ") // remove the "-" sign
Js:
Var testStr = "SSSSS
VVVVV ";
Var resultStr = testStr. Replace (/ \ + / g, ""); // remove the Spaces
ResultStr = testStr. Replace (/ [] / g, ""); // remove the Spaces
ResultStr = testStr. Replace (/ \ r \ n/g, "")); // get rid of the carriage return and line feed