473,581 Members | 2,694 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clear value in a text box using onClick

1 New Member
i want to be able to clear the value in the text box as soon as I click on it. I thought the code may be something like this:

onClick="(this. value='')"

Any Suggestions?
May 24 '07 #1
4 117214
13,262 MVP
i want to be able to clear the value in the text box as soon as I click on it. I thought the code may be something like this:

onClick="(this. value='')"

Any Suggestions?
Moved to Javascript forum
May 25 '07 #2
5 New Member
If u want to clear all the text box and change other controls to inital mode then u can simply have your controls inside a form and then use the following code
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. fromreset()
  3. {
  4. myform.reset(); //will reset all the controls in ur page to initial stage.
  5. (or) 
  6. document.myform.[textbox Id] = " "; // will clear the textbox alone
  7. }
  9. <form name="myform" id="myform">
  10. your code
  11. may be you have some button ... on that button's onclick option
  12. onclick = "javascript:formreset();">
  13. </form>
May 25 '07 #3
5,390 Recognized Expert Moderator Expert
i want to be able to clear the value in the text box as soon as I click on it. I thought the code may be something like this:

onClick="(this. value='')"

Any Suggestions?
... what's wrong with it? the following example works just fine (actually tested in IE, MOZ, FF):

Expand|Select|Wrap|Line Numbers
  1. <input type="text" id="tx" name="tx" value="click" onclick="this.value='';"/>
post some lines of code where an error occurs

kind regards ...
May 25 '07 #4
1 New Member
It works, I just added:

Expand|Select|Wrap|Line Numbers
  1. onclick="this.value='';"
Thanks a lot!
Feb 17 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

by: mikea_59 | last post by:
I would like to use XSLT to translate some tagged value text to XML elements like this: Input Doc: <data>x=1.234 y=ABC z="Hello World"</data> Output Doc: <x>1.234</value>
by: yawnmoth | last post by:
In IE6, setting clear to both in a span tag seems to work, whereas it doesn't seem to work in Firefox. A demonstration can be found here: http://www.frostjedi.com/terra/dev/test3.html Any ideas as to why this might be, and what can be done to make Firefox's rendition of the page the same as IE6's, without using div? Also, I tried...
by: Lena | last post by:
I have generated a proxy class derived from System.Web.Services.Protocols.SoapHttpClientProtocol One of my classes is defined as public class MyClass { public MyClass() {
by: Shyguy | last post by:
I have a form where one of the entries is "Contact". On BeforeUpdate I check the table for the existance of that Contact. A mesage box informs the user that the name is already in the table and cancels the event. What I want to do is clear the text from the text box to allow the user to enter another name without deleting it. I have...
by: lavdey | last post by:
I am a beginner user of Access. I have developed a database for a non-profit to manage contacts. I would like to change a value in a record by using OnClick. For example, If the value is "Member" I would like to change it to "Past Member" by clicking a label "Convert to Past Member" Thanks Len
by: Bishman | last post by:
Hi, I have been trying to get text to scroll smoothly accross a windows form using GDI+ and a timer. Changing the position of the text by a configurable amount and calling invalidate to force a redraw at various intervals ( based on the timer ). The text is not moving that smoothly, it seems very jerky, no matter what combination of timings...
by: ScripterSam | last post by:
I have several text box and a clear button... I want the clear button to clear the text box content which I focus. Please help.. urgent..
by: iDesmet | last post by:
Good day! I was wondering if someone could show me the way with this little problem I have. I need to get the value/text of every checked SubItems in a listview so I can execute a Sub. The Sub I had created needs such value for inserting data in MySQL. My Sub is called: InsertSelItem(ByVal SelItem As Integer)
by: research_stuff | last post by:
I have researched unhiding text using Javascript. I found examples unhiding text boxes. I need to unhide text when a radio button has been selected. Can someone point me to an example? Thanks in Advance.
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.