views:

22

answers:

2

Hey guys,

if I had a HTML form like so...

    <form>
    First name: <input type="text" name="firstname" /><br />
    Last name: <input type="text" name="lastname" /> 
    </form>

How would I auto fill both First name and Last Name with a default value? e.g "joe".

Thanks.

+3  A: 

Use the value attribute.

… but please make them sensible defaults (e.g. "The user's name as stored in their account on your site") and not examples.

(And do use label elements instead of free text for your labels).

David Dorward
A: 

Use the value attribute

<form>
First name: <input type="text" name="firstname" value="john" /><br />
Last name: <input type="text" name="lastname" value="doe" /> 
</form>
Eric Darchis