实现代码如下:

<SPAN style="FONT-SIZE: 18px">表单类失去焦点的效果</SPAN>

实现代码如下:

<script type="text/javascript">
$(function(){
$(":input").focus(function(){ //此处可获取各种表单如(:text/:button)
$(this).addClass("focusa");
if ($(this).val()==this.defaultValue){
$(this).val("");
}
}).blur(function(){
$(this).removeClass("focusa");
if ($(this).val()==""){
$(this).val(this.defaultValue);
}
});
});
</script>

各种表单的类型:
实现代码如下:

<input type="text" /> 文本框
<input type="password" /> 密码框
<input type="submit" /> 提交按钮
<input type="reset" /> 重置按钮
<input type="radio" /> 单选框
<input type="checkbox" /> 复选框
<input type="button" /> 普通按钮
<input type="file" /> 文件选择控件
<input type="hidden" /> 隐藏框
<input type="image" /> 图片按钮

以上就是【表单类各种类型(文本框)失去焦点效果jq代码】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论