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

后端 未结 13 575
悲哀的现实
悲哀的现实 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:31

    Here is a simple example, all it does is overlay an image (with whatever wording you want). I saw this technique somewhere. I am using the prototype library so you would need to modify if using something else. With the image loading after window.load it fails gracefully if javascript is disabled.

    
    
    
        
        
        
        
        
    
        
    
    
        
    
        
    
    
    

提交回复
热议问题