I want an onclick event such that, when my visitors click on any field on my form, the default value disappears.
adsegzy
how to create onclick event?
Moderator: General Moderators
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: how to create onclick event?
Code: Select all
<input onclick="alert('replace this alert with a function');" />Re: how to create onclick event?
You'd better use the onfocus event (Tab navigation
)
There are 10 types of people in this world, those who understand binary and those who don't
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: how to create onclick event?
Agreed, I love sites that utilize blur and focus events. 
Re: how to create onclick event?
w3c say not to use inline CSS and JavaScript, which is sometimes a pain in the ass. But it would give something like this if your element has, let's say, an id value of 'myID'
Code: Select all
onload=function()
{
document.getElementById('myId').onclick=function()
{
this.value=''
}
}