HTML form auto fill values?
if I had a HTML form like so...
<form>
First name: <input type="text" name="firstname" />&开发者_运维技巧lt;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.
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).
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>
精彩评论