In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces jquery how to delete the first character of the string, the article is very detailed, has a certain reference value, interested friends must read it!
Delete the first character of the string method: 1, use the "$(selector). Val ()" statement to get the string content in the element; 2, use the substr () method to intercept the string, and then delete the first character in the string, the syntax is "string content .substr (1, string length)".
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
In jquery, you can use the substr () method to intercept a string to delete the first character in the string.
Example:
In the test.html file, inside the p tag, use the input tag to create a string input box that specifies the string to operate on.
In the test.html file, set the id of the input tag to myinput, which is mainly used to obtain the input object through this id.
In the test.html file, use the button tag to create a button with the name "remove the first character".
In the test.html file, bind the onclick click event to the button button, and execute the myfun () function when the button is clicked.
Within the js tag, create the myfun () function. Within the function, get the input object through id (myinput), use the val () method to get the input string, then use the substr () function to intercept from the second character, and finally, use the alert () method to output the intercepted string.
Open the test.html file in the browser, enter the string, click the button to view the result.
The above is all the content of the article "how to delete the first character of a string in jquery". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.