HTML 5 placeHolder

<html>
<body>
<input type="text" id="idNum" placeholder="placeholder" value="">
<script type="text/javascript">
var o = document.getElementById("idNum");
with(o){
alert(value);
alert(placeholder);
}
</script>
</body>
</html>

PlaceHolder IE9不支持,IE11支持。

时间: 2024-07-29 21:51:45

HTML 5 placeHolder的相关文章

UITextView添加Placeholder(swift)

UITextView添加Placeholder(swift) by 伍雪颖 添加UILabel并初始化 public let placeholderLabel: UILabel = UILabel() @IBInspectable public var placeholder: String = "" { didSet { placeholderLabel.text = placeholder } } @IBInspectable public var placeholderColor

修改HTML5 input placeholder 颜色及修改失效的解决办法

input::input-placeholder{color: #bdbdbd ;} /* 有些资料显示需要写,有些显示不需要,但是在编辑器webstorm中该属性不被识别 */ ::-webkit-input-placeholder { /* WebKit browsers */ color: #999; } :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: #999; } ::-moz-placeholder { /* Mozi

input获得焦点时改变placeholder文本的样式

HTML: <input type="text" placeholder="sample text"/> CSS: input::-webkit-input-placeholder { color: #999; } input:focus::-webkit-input-placeholder { color: red; } /* Firefox < 19 */ input:-moz-placeholder { color: #999; } inpu

兼容placeholder

众所周知.IE9以下不兼容placeholder属性,因此自己定义了一个jQuery插件placeHolder.js.以下为placeHolder.js的代码: /** * 该控件兼容IE9下面,专门针对IE9下面不支持placeholder属性所做 * Author: quranjie * Date:2014-09-26 */ $(function() { // 假设不支持placeholder,用jQuery来完毕 if(!isSupportPlaceholder()) { // 遍历全部i

placeholder属性

placeholder属性 是在input输入框内提示内容(内容自定义)如下图所示: position: absolute:绝对定位并且不占位置: relative:相对定位占位置 我们在设置定位时一般是采用 子绝父相 的原则,但是也可以用 子绝父绝 的模式,但是这个时候父级元素就不占位置,脱离标准流...

PlaceHolder的两种实现方式

placeholder属性是HTML5 中为input添加的.在input上提供一个占位符,文字形式展示输入字段预期值的提示信息(hint),该字段会在输入为空时显示. 如 1 <input type="text" name="loginName" placeholder="邮箱/手机号/QQ号"> 目前浏览器的支持情况 浏览器 IE6/7/8/9 IE10+ Firefox Chrome Safari  是否支持 NO YES YE

IOS UITextField. placeholder属性这个提示符的大小和颜色

用UITextField都知道,默认有个提示,原理是kvc,监听, textField.placeholder = @"This is textField.placeholder"; [textField setValue:[UIColor green] forKeyPath:@"_placeholderLabel.textColor"]; [textField setValue:[UIFont boldSystemFontOfSize:15] forKeyPath

placeholder的样式设置

在input框中有时想将输入的字和placeholder设为不同的颜色或其它效果,这时就可以用以下代码来对placeholder进行样式设置了. ::-webkit-input-placeholder{}    /* 使用webkit内核的浏览器 */ :-moz-placeholder{}                  /* Firefox版本4-18 */ ::-moz-placeholder{}                  /* Firefox版本19+ */ :-ms-inpu

IE8 不支持html5 placeholder的解决方案

IE8不支持html5 placeholder的解决方法. /** * jQuery EnPlaceholder plug * version 1.0 2014.07.01戈志刚 * by Frans.Lee <[email protected]> http://www.ifrans.cn */ (function ($) { $.fn.extend({ "iePlaceholder":function (options) { options = $.extend({ pl

input placeholder

最近写接触到 input 中这个属性placeholder ,需要设置placeholder 中值得样式,直接在该标签中添加style,就可以控制,控制位置,颜色,字体大小. 查查资料,一些总结的特别的全面,贴这里,学习了. http://www.jb51.net/html5/171764.html http://www.oschina.net/question/5189_22929