开发者

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜