Simple way to check if placeholder is supported?

后端 未结 9 892
执笔经年
执笔经年 2020-12-29 01:00

I want to use the HTML5 \"placeholder\" attribute in my code if the user\'s browser supports it otherwise just print the field name on top of the f

9条回答
  •  无人及你
    2020-12-29 01:30

    http://html5tutorial.info/html5-placeholder.php has the code to do it.

    If you're already using jQuery, you don't really need to do this though. There are placeholder plugins available ( http://plugins.jquery.com/plugin-tags/placeholder ) that will use the HTML5 attribute where possible, and Javascript to simulate it if not.

提交回复
热议问题