- Joined
- Jun 1, 2010
- Posts
- 548
- Reaction score
- 2
I'm using the following to set up the input fields in my form:
<input class="form2" onfocus="this.select()" onblur="this.value=!this.value?'Mobile':this.value;" onclick="this.value='';"/ type="text" name="mobile" size="24" style="color:#888;"
value="Mobile" />
This displays what to enter in the field (eg. name, mobile), which then disappears on click and comes back if nothing is entered and the user clicks outside of the box. The 'value=""' attribute is needed otherwise no text appears in the input fields from page load, only once a user has clicked in and out of the field.
I have a text area at the bottom of my form which I want to behave in the same manner. I can get it to display the default text I want when the user has clicked in and out of the box, but not from page load. I've added the value attribute but it doesn't make any difference..
Can anyone help? The code I'm using for the text area is as follows:
<textarea class="form2" onfocus="this.select()" onblur="this.value=!this.value?'Description (50 words max)':this.value;" onclick="this.value='';"/ rows="9" style="color:#888" name="message" cols="30" value="Description (50 words max)"></textarea>
<input class="form2" onfocus="this.select()" onblur="this.value=!this.value?'Mobile':this.value;" onclick="this.value='';"/ type="text" name="mobile" size="24" style="color:#888;"
value="Mobile" />
This displays what to enter in the field (eg. name, mobile), which then disappears on click and comes back if nothing is entered and the user clicks outside of the box. The 'value=""' attribute is needed otherwise no text appears in the input fields from page load, only once a user has clicked in and out of the field.
I have a text area at the bottom of my form which I want to behave in the same manner. I can get it to display the default text I want when the user has clicked in and out of the box, but not from page load. I've added the value attribute but it doesn't make any difference..
Can anyone help? The code I'm using for the text area is as follows:
<textarea class="form2" onfocus="this.select()" onblur="this.value=!this.value?'Description (50 words max)':this.value;" onclick="this.value='';"/ rows="9" style="color:#888" name="message" cols="30" value="Description (50 words max)"></textarea>