Javascript text input fields that display instruction (placeholder) text

后端 未结 7 2076
抹茶落季
抹茶落季 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:39

    Make the input transparent and put the text behind it. Check the value onload, onblur to decide if the text should be visible or not. Make it invisible onfocus.

    For example: http://dorward.me.uk/tmp/label-work/example.html (you just need to style the label and input with different foreground colours)

提交回复
热议问题