Javascript text input fields that display instruction (placeholder) text

后端 未结 7 2078
抹茶落季
抹茶落季 2021-02-04 13:17

What\'s the best way to have a text input field that displays instructions of what to enter in that field in gray. When you focus on that input field, the gray instruction text

7条回答
  •  说谎
    说谎 (楼主)
    2021-02-04 13:46

    You don't need javascript for this.

    HTML5:

    
    

    This works in modern browsers. If you add modernizr.js to your page then it'll work in all browsers.

提交回复
热议问题