SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
-
Apr 25, 2007, 14:59 #1
- Join Date
- Apr 2007
- Posts
- 8
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Delete OnClick with an input field.
What is the code to basically delete text within an input field when a mouse cursor is clicked within the field such as a input type text. Thanks a bunch!
-
Apr 25, 2007, 15:48 #2
- Join Date
- Jan 2005
- Location
- Too far up north
- Posts
- 1,566
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Show us what you have so far and lets take it from there.
-
Apr 25, 2007, 16:01 #3
- Join Date
- Apr 2007
- Posts
- 8
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I have no clue where to start, I assume it would be an OnClick function, but I don't know. Newb here
-
Apr 25, 2007, 16:13 #4
- Join Date
- Jan 2005
- Location
- Too far up north
- Posts
- 1,566
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
This is a perfect opportunity for you to learn JavaScript. Spend some time learning it! Fun huh?
-
Apr 26, 2007, 05:37 #5
- Join Date
- Aug 2006
- Posts
- 266
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:<form> <input type="text" name="txt1" value ="my text value" onfocus="if(this.value==defaultValue){ this.value ='';} ";> <input type="text" name="txt1" value ="my text value" onfocus="this.value='' ";> </form>
-
Apr 26, 2007, 05:46 #6
- Join Date
- Oct 2002
- Location
- Scotland
- Posts
- 3,631
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Or use onclick instead of onfocus.
Bookmarks