Solved

how to highlight text in textbox when in focus in

Posted on 2009-07-07
4
806 Views
Last Modified: 2012-05-07
I have a webform with textboxes if a user clicks on the textbox I want all the text in the textbox to be selected (highlighted)
0
Comment
Question by:mugsey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 15

Accepted Solution

by:
crisco96 earned 300 total points
ID: 24793105
<asp:textbox runat="server" text="Some Text" onfocus="this.select()" />
0
 
LVL 7

Assisted Solution

by:Valleriani
Valleriani earned 200 total points
ID: 24793115
If you are looking to highlight text in a textbox then you can do:

TextBox1.Attributes.Add("onFocus", "JavaScript:this.select();") for example!
0
 
LVL 7

Assisted Solution

by:Valleriani
Valleriani earned 200 total points
ID: 24793136
If it's using for example a inputbox, you could also just use:

<input type="text" name="test" onclick='this.select();'/>
0
 
LVL 7

Expert Comment

by:Valleriani
ID: 24793138
Oh my bad crisco96 already stated it above ;)
0

Featured Post

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question