Linked Questions
74 questions linked to/from How to highlight text using javascript
-1 votes
2 answers
657 views
How to change color of searched text when a value is entered [duplicate]
Is there any way such that when user enters any value in search box then it's color is changed . Like this : User enters : laptop Then laptop color changes from the class="deviceNameCardHead"...
0 votes
1 answer
267 views
How can I "paint" a highlighter onto text? [duplicate]
I want to have text that when click-dragged over, highlights the text and stores the highlighted text in a variable. I'm not sure where I would start with this, from my research it looks like it ...
-2 votes
1 answer
201 views
How can I add css to a word inside a div that matches the word from the search box? [duplicate]
I have a searchbox where you can search for words and pages will display with the searched-for word in the description of the page(meaning if the word you searched for is in the description of the ...
-3 votes
3 answers
191 views
Need to high light letters on search [duplicate]
Here is the fiddle where i have search and working good but i want to change the existing code for getting letters background highlighted not total word. only letters background highlight........ ...
0 votes
0 answers
88 views
How to Highlight Text in HTML While Ignoring Tags Without Breaking Valid HTML? [duplicate]
I'm trying to highlight text within an HTML string while ignoring any HTML tags inside the text. However, my current approach sometimes wraps only part of the text and breaks the HTML structure. What ...
0 votes
1 answer
84 views
Format a word (make it red) with a Chrome Extension [duplicate]
Not a dupe... Non of mentioned work.. Trying to highlight a word with a google extension. Running this as a content script, but it doesn't seem to be a working solution... What have I missed? var ...
108 votes
13 answers
200k views
Highlight a word with jQuery
I basically need to highlight a particular word in a block of text. For example, pretend I wanted to highlight the word "dolor" in this text: <p> Lorem ipsum dolor sit amet, ...
313 votes
1 answer
83k views
What exactly is the `#:~:text=` location hash in an URL? [closed]
Today I noticed that some searches on Google gave me links to results with apparent instructions to highlight text. Google brought me to What is the maximum size of a zip file on Windows 10 Pro 64... ...
30 votes
9 answers
46k views
javascript user selection highlighting
I'm trying to find a way with javascript to highlight the text the user selects when they click some odd highlight button (as in <span style="background-color:yellow">highlighted text</span&...
11 votes
5 answers
6k views
How to highlight HTML text without wrapping it with tags?
Is it possible to highlight text in an HTML document using without wrapping it with <span> or any other tag for that matter? For example, in the HTML code <p>The quick fox</p> I ...
4 votes
5 answers
22k views
highlighting all matching words in div from text input
I have made a function which highlights matching words in a div. but if there are two identical words separated by a different word then only the first word is highlight. so for example if the search ...
6 votes
2 answers
16k views
Calculate Position of selected text javascript/JQuery?
How to retrieve the position of selected text by calculating it's offset immediate after body tag? For Example consider the following html, <body> <div>hi</div> <div>dude!<...
6 votes
2 answers
15k views
Highlighting text within an input field
I'm trying to create a script in JS that highlights certain text as it's typed by the user (sort of like the "Test String" box from https://regex101.com/), but can't seem to change the text ...
3 votes
5 answers
7k views
How to highlight search text from string of html content without breaking
I am looking for some solution that help to search term from html string with highlight feature. I can do this by removing html content from string. But then issue is I will not able to see it ...
3 votes
4 answers
5k views
Javascript - How to style specific word in a string of text?
I have a string of text here that will be dynamically generated to be one of the following: <h1 id="headline">"Get your FREE toothbrush!"</h1> OR <h1 id="...