This article mainly introduces the usage of the jquery string cut function substring. If you need it, you can refer to it and hope to help you.
The Code is as follows: <! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN"> <HTML> <HEAD> <TITLE> usage of the jquery string cutting function substring </TITLE> <meta name = "Generator" CONTENT = "EditPlus"> <meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8 "> <meta name =" Author "CONTENT =" Fanglor "> <meta name =" Keywords "CONTENT =" jquery string cut function substring usage "> <meta name = "Description" CONTENT = "jquery string cutting function substring usage"> <script type = "Text/javascript" src = "jquery. js"> </script> <script language = "JavaScript"> <! -- Function sclip () {if ($ ("# txt1 "). val (). length> 6) {$ ("# txt2 "). val ($ ("# txt1 "). val (). substring (0, 6);} else {$ ("# txt2 "). val ($ ("# txt1 "). val ());}} // --> </SCRIPT> </HEAD> <input type = "text" id = "txt1"/> <input type = "text" id = "txt2"/> <input type = "button" onClick = "sclip (); "value =" do it... "/> <BODY> </HTML>