How to Get Substring from a String Using jQuery
In this tutorial, we are going to see how to Get Substring from a String Using jQuery. You can simply extract a substring from a string using JavaScript’s substring() method. The substring() method returns a substring based on two arguments: start(required) and end position(optional).
If the end position is not specified, the rest of the string is extracted.
How to Get Substring from a String Using jQuery
$(document).ready(function(){ var str = "Lorem ipsum dolor sit amet, adipiscing elit."; var subStr = str.substring(6, 17); alert(subStr); });
Output:
ipsum dolor