Forum Moderators: open
are there any other ways to do it?
Thanks in advance
Regards
Buddha
You also only want to do this the first time they enter the control, as it will clear what they typed!
// Assign the event when document loads
var x = document.getElementById('cname'); // NB: set **ID** of object
if (x!= null) {
x.onfocus = initTextArea;
}
// Clears textarea and changes style when clicked on for the first time
function initTextArea() {
this.onfocus = null;// Clear event so won't call again
this.value = '';
this.style.color = '#000000';// It could be styled initially as #cccccc;
}
You will also need to modify your form validation, as if "Type your message here" is still in the box then they have not actually entered anything.