Onclick event to remove default value in a text input field

前端 未结 9 1272
傲寒
傲寒 2021-02-02 14:57

I have an input field:


How would I get it to remove the pre-defined text (Enter Your Name

9条回答
  •  北恋
    北恋 (楼主)
    2021-02-02 15:20

    In addition to placeholder="your text" you could also do onclick="this.value='';

    So it would look something like:

    
                                                            
提交回复
热议问题