jquery获取焦点和失去焦点
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src='../jquery.js'></script>
<style>
.hide{display:none}
.test{background:green}
</style>
</head>
<body>
<div id='test'>ttttt</div>
<input type='text' id='adress' value='请输入' />
<script>
$(function(){
$('#adress').focus(function(){
var text=$(this).val();
if(text=='请输入'){
$(this).val('');
}
});
$('#adress').blur(function(){
var text=$(this).val();
if(text==''){
$(this).val('请输入');
}
});
});
</script>
</body>
</html>
最新文章
- [POJ&;HDU]杂题记录
- 记一个简单的sql查询
- MVC 理解小谈
- appframework(jqmobi) 3.0 设置
- Git &; Github 一页简明笔记
- javaScript没有块级作用域
- 作为一个web开发人员,哪些技术细节是在发布站点前你需要考虑到的
- LA 4123 (计数 递推) Glenbow Museum
- iOS之隐藏状态栏
- lua协程实现简析
- 英语学习App演示
- Android开发艺术探索》读书笔记 (12) 第12章 Bitmap的加载和Cache
- H5与CS3权威下.18 and 19 选择器(1)
- MVVM 模版里的控件怎样触发命令
- python 中一些关键字的区别
- ASp.Net Mvc Core 重定向
- 3038 3n+1问题
- .NET Core错误:The specified framework &#39;Microsoft.NETCore.App&#39;, version &#39;1.0.0-rc2-3002702&#39; was not found.
- python-数据分析与展示(Numpy、matplotlib、pandas)---1
- hdu some problems in Multi-University Training Contest