Cursor can not move through all the characters within textbox after textbox.select()
-
I want to highlight text in textbox on focus of it. I have called textbox.select(). The problem after execution of textbox.select() is, cursor can only move to begining of the text or to the end of text in textbox. It is not going through the characters which are in the middle. Cursor directly jump to begining or end character in the textbox when moved. Can somebody suggest the solution over this (I am doing all this stuff in javascript, so javascript solution is most welcome). Thank you.
Ashish Software Engineer, Pune
-
I want to highlight text in textbox on focus of it. I have called textbox.select(). The problem after execution of textbox.select() is, cursor can only move to begining of the text or to the end of text in textbox. It is not going through the characters which are in the middle. Cursor directly jump to begining or end character in the textbox when moved. Can somebody suggest the solution over this (I am doing all this stuff in javascript, so javascript solution is most welcome). Thank you.
Ashish Software Engineer, Pune
I take it then that you do not actually wish the text in the textbox to be selected, as the behavior of the cursor with regard to selected text is plaform- and browser- dependant. So just change the background and text color of the textbox:
var textbox = document.getElementById("textbox");
textbox.style.backgroundColor = "blue";
textbox.style.color = "white";...etc.
----
You're right. These facts that you've laid out totally contradict the wild ramblings that I pulled off the back of cornflakes packets.