The string can be contained directly in the element as text, or in a child element. To count string characters length in jQuery, use the jQuery length property to find the number of characters in a string. Given an HTML document and the task is to select the elements with ID starts with certain characters using jQuery. In this tutorial, you will learn how to check if string contains backslash in javascript. Check if the URL Bar Contains a Specified or Given String Also note that string positions start at 0, and not 1. You will need this if you are working on a web site that depends on data extracted from the URL. Regex. Today, I would like to show you a way, how you can check a string for certain letters, numbers or characters. Let’s take a look into below source to see how it works. Check window.location.search. To check whether string contains particular text or not in jQuery we need to write the code like as shown below.