Find Text Programmatically With textRange

Find Text Programmatically With textRange

Browsers Targeted: Internet Explorer 4+

You can find a string of text within a document programmatically using the textRange object, which handles most of the internal string manipulation capabilities in Internet Explorer. Specifically, the textRange.findText() function will help you locate the string in question. For example, this script will locate the term typed into the input field anywhere within the document, and will then select that range.


The third parameter of the findText method can be used to restrict the search. Normally, the value of this parameter is 0. If it’s set to 2, then the expression will only match whole words. If set to 4, the expression becomes case sensitive (by default, it’s not).

See also  How College Students Can Shape the Future of Tech Responsibility

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist