?
Solved

how to highlight text in textbox when in focus in

Posted on 2009-07-07
4
Medium Priority
?
808 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 1200 total points
ID: 24793105
<asp:textbox runat="server" text="Some Text" onfocus="this.select()" />
0
 
LVL 7

Assisted Solution

by:Valleriani
Valleriani earned 800 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 800 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

762 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