+ 9

Multiple cursor textarea

Is it possible to have multiple separate cursors (caret) in text area by pressing ctrl+alt keys like in code editors? how can I do that using javascript? P.D: I googled before

13th Oct 2020, 9:06 PM
CoffeeByte - avatar
4 Answers
+ 5
Sounds very hard. I think the best option would be to create a custom textarea by your own. Disable the standard caret (I guess this can be done with CSS alone) and create your own carets with CSS and Javascript. Looks like multiple selection is available on Firefox only so you are likely going to need to re-invent that too: https://developer.mozilla.org/en-US/docs/Web/API/Selection/addRange
13th Oct 2020, 10:14 PM
Kevin ★
+ 10
I hope this is your requirement. <input id="edValue" type="text" onKeyPress="edValueKeyPress()" onKeyUp="edValueKeyPress()"><br> <span id="lblValue">The text box contains: </span> <input id="secvalue" type="text"> </body> this is script tag sl having some problems to write correct tag 😜 <scrip > function edValueKeyPress() { var edValue = document.getElementById("edValue"); var s = edValue.value; var lblValue = document.getElementById("secvalue"); lblValue.value = s; } </scrip>
21st Jan 2022, 1:38 AM
Vaibhav - avatar
+ 7
Kevin ★ thanks, I've been thinking in a custom HTML element extended from textarea
13th Oct 2020, 10:21 PM
CoffeeByte - avatar
+ 4
there is probably a library for html code editor, I've seen visual studio code and repl.it used a very similar editor that have support for multiple caret.
13th Oct 2020, 9:12 PM
Apollo-Roboto - avatar