Text in HTML Field to disappear when clicked?

后端 未结 7 568
悲&欢浪女
悲&欢浪女 2020-12-13 18:12

I can easily create a html input field that has text already in it. But when the user clicks on the input field the text doesn\'t disappears but stays there. The user then h

相关标签:
7条回答
  • 2020-12-13 18:54

    try this one out.

    <label for="user">user</label>
    <input type="text" name="user" 
    onfocus="if(this.value==this.defaultValue)this.value=''"    
    onblur="if(this.value=='')this.value=this.defaultValue" 
    value="username" maxlength="19" />
    

    hope this helps.

    0 讨论(0)
提交回复
热议问题