Linked Questions

0 votes
1 answer
2k views

I am trying to highlight the text inside a div / span automatically when the page loads. I am able to highlight text in a read-only textbox but, the text inside a div / span, is not working. I am ...
JGV's user avatar
  • 5,207
-1 votes
1 answer
1k views

I wish to make a single line in a div highlighted when clicked (not the whole div selected) I can use jquery or javascript as needed. The div new lines are separated by br tag. <div class="...
J. Podolski's user avatar
0 votes
1 answer
404 views

How can I select all text in an element? <div class="wrapper"> <div class="content">Lorem ipsum dolor sit amet.</div> </div> "Wrapper" is an ElementRef. How can I select ...
bui quang huy's user avatar
0 votes
2 answers
522 views

I want to perform an action when the user selects any text at the page. I tried something like this: var selObj; document.querySelector("p").onselect = function(){ selObj = window....
Mr Guliarte's user avatar
0 votes
0 answers
305 views

I am trying to create a button that will assign a class to a div that wrap a bunch of html elements for the purpose of manually selecting and copying what is selected on the browser "ctrl-c". I have ...
Danny's user avatar
  • 1,195
0 votes
1 answer
127 views

I have a text input. <input type="text" id="foo" name="bar" value="11 Minutes"/> I want it so when the user clicks on the input, that the user's "Cursor" or "Selector" is after the 11, not ...
Goose's user avatar
  • 4,833
0 votes
0 answers
140 views

I am trying to select all the text with a <code> or HTML element. I have tried a lot of things but I think that jQuery .select() only works for input boxes. jQuery('code').click(function () { ...
TheBlackBenzKid's user avatar
0 votes
0 answers
36 views

How can I select textcontent before it is copied to the clipboard? Here is an idea of selecting with one click: https://stackoverflow.com/a/1173319. But this is an other code with id selector. I only ...
user avatar
0 votes
0 answers
33 views

The Selection API allows me to get the current selection with window.getSelection() and edit the selection with selection.modify('extend', 'backward', 'character'); to, for example, go back a ...
mikemaccana's user avatar
133 votes
6 answers
127k views

How can I make it so when you click inside a textarea, its entire content gets selected? And eventually when you click again, to deselect it.
Alex's user avatar
  • 66.6k
35 votes
4 answers
45k views

I am looking for a way to select the text inside a span using jquery when the text is clicked on. For example in the html snippet below, I want the text "\apples\oranges\pears" to become selected ...
MrVimes's user avatar
  • 3,322
42 votes
5 answers
36k views

Before this is flagged as a duplicate, I want you to realize that no one has actually provided a good answer for this specific question. In select all text in contenteditable div when it focus/click, ...
Zerium's user avatar
  • 17.4k
25 votes
6 answers
57k views

I have a function in my script that gives me an error. The function purpose is to copy text from static panel(not textbox or input) with onClick event. Uncaught TypeError: copyText.select is not a ...
user avatar
22 votes
6 answers
1k views

I have some text: <p class="drag">Hello world, Attack on Titan season two!</p> Currently, if a user wants to highlight a word/term with the cursor, they will click and drag, letter by ...
Henrik Petterson's user avatar
13 votes
8 answers
36k views

I have a div which contains a series of span tags, each containing a string of text. I'd like to attach a jQuery click event to all of the spans so that when the text inside any span is clicked, the ...
Scott B's user avatar
  • 40.4k

15 30 50 per page
1
2 3 4 5
9