jquery - Deselect contents of a textbox with javascript -
I understand that with javascript you can select the contents of a text box with the following code (in jQuery) :
. Select $ ("# txt1") (); What is the way to do the opposite? To unselect the contents of the text box? The focus of many text boxes set to select the content inside of me is the event. I have many times that I want to focus on a particular text box without choosing it. What I'm planning to do, the focus is calling the event for this particular text box, but then follow it with a call to deselect it.
$ ("input [type = text]"). Focus (function () {$ (this) .select ();}); // code .... $ ("# txt1"). Focus (); Any ideas?
Thank you!
What's this about:
$ ("input" ). Focus (function () {this.selectionStart = this.selection.and = - 1;});
Comments
Post a Comment