1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > 设置easyui input默认值

设置easyui input默认值

时间:2021-03-31 17:04:59

相关推荐

设置easyui input默认值

/*设置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>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。