How to create a label inside an <input> element?

后端 未结 13 579
悲哀的现实
悲哀的现实 2021-01-29 22:54

I would like to insert a descriptive text inside an input element that disappers when the user click on it.

I know it is a very common trick, but I do not know how to do

相关标签:
13条回答
  • 2021-01-29 23:47

    You do not need a Javascript code for that...
    I think you mean the placeholder attribute. Here is the code:

    <input type="text" placeholder="Your descriptive text goes here...">
    



    The default text will be grey-ish and when clicked, it will dissapear!

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