设置easyui input默认值
2013-07-09 17:19
120 查看
/*设置input 焦点*/ $(function () { //集体调用 $(".formTextBoxes input").each(function () { $(this).setDefauleValue(); }); //单个调用 $(".textkey").setDefauleValue(); }) //设置input,textarea默认值 .之前写法$.fn.seDefauleValue = function(){ $.fn.setDefauleValue = function () { var defauleValue = $(this).val(); $(this).val(defauleValue).css("color", "#999"); return this.each(function () { $(this).focus(function () { if ($(this).val() == defauleValue) { $(this).val("").css("color", "#000"); //输入值的颜色 } }).blur(function () { if ($(this).val() == "") { $(this).val(defauleValue).css("color", "#999"); //默认值的颜色 } }); }); }
Html:
<div class="formBoxes formTextBoxes clearfix"> <input id="txtSearch" type="text" value='@ViewBag.SearchText' class="searchMainBtn easyui-validatebox" /> <div id="btnSearch" class="btnGo" >@ViewBag.Search</div> </div>
相关文章推荐
- Easyui combobox 设置默认值
- EasyUI datetimebox设置默认值为当前时间
- input文本框设置和移除默认值
- input文本框设置和移除默认值
- EasyUI Combobox 设置默认值
- input文本框设置和移除默认值
- EasyUI datetimebox设置默认值为当前时间
- 如何设置input默认值,点击清除,离开恢复 ?
- react input 设置默认值
- Easyui中combogrid设置默认值
- easyui combobox设置默认值 获取text
- [前端_EasyUI]给easyui的datebox设置默认值,获取不到 的解决方法
- input如何设置默认值
- 使用jQuery给input标签设置默认值
- HTML input 默认值设置
- HTML input 默认值设置
- easyui input readonly设置
- 日期类型的input元素设置默认值为当天
- input默认值设置
- 如何设置上传文件控件 input type="file" 的 默认值