When I want to add a label to a word in the text area, the label is not accepted. Is there any way to label text in a textarea by clicking on the word I want to label? For example span tag
<label> <textarea class="string-example" name="textarea3" id="textarea3" cols="122" rows="17">Lorem ipsum dolor sit amet...</textarea> </label>
Double-click the text in the text area and the text will be highlighted. If you just want to style, use CSS:
::selection
Either use instead of textarea,
or
Use Textarea as DIV overlay - it will have highlighted tag
The above is a proof of concept, you will still need JavaScript to clone text into a
.highliter
DIV, insertingelements child elements around the desired text
selection
- and make sure (if necessary) that the underlying DIV scrolls in sync with the text area.I'll leave the click selection to the reader.