substring from a string in jquery code example Example: substring from a string in jquery var subStr = str1.substring(0, 5);