Thanks to visit codestin.com
Credit goes to www.tutorialspoint.com

jQuery String Methods



jQuery string methods helps in string manipulation and makes your work easier while using strings. String methods find the length of the string, a string in a string, extract string parts, etc. jQuery is a JavaScript library, so using JavaScript String functions in it is perfectly fine.

Example

You can try to run the following code to learn how to find the length of a string with string method −

Live Demo

<!DOCTYPE html>
<html>
<body>

<p>Finding the number of characters in "Tutorialspoint"</p>

<button onclick="myFunc()">Get Length</button>

<p id="example"></p>

<script>
function myFunc() {
    var str1 = "Tutorialspoint";
    var num = str1.length;
    document.getElementById("example").innerHTML = num;
}
</script>

</body>
</html>
Updated on: 2020-02-13T07:21:52+05:30

805 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements