Delete default value of an input text on click

前端 未结 13 1991
逝去的感伤
逝去的感伤 2020-11-29 18:24

I have an input text :


I want to put a default value like

13条回答
  •  旧巷少年郎
    2020-11-29 19:02

    For future reference, I have to include the HTML5 way to do this.

    
    

    If you have a HTML5 doctype and a HTML5-compliant browser, this will work. However, many browsers do not currently support this, so at least Internet Explorer users will not be able to see your placeholder. However, see http://www.kamikazemusic.com/quick-tips/jquery-html5-placeholder-fix/ (archive.org version) for a solution. Using that, you'll be very modern and standards-compliant, while also providing the functionality to most users.

    Also, the provided link is a well-tested and well-developed solution, which should work out of the box.

提交回复
热议问题