<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> jquery 提示语淡入</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="" />
<style type="text/css">
.tishi-com{display:none;width:65px;height:20px;line-height:20px; background:#fff9c9; border:1px solid #c7bf93; color:#666;
position:relative;left:230px;top:-22px;}
</style>
<script type="text/javascript" src="jquery-3.0.0.js"></script>
</head> <body>
<div style="width:500px;height:200px;border:1px solid #E5E5E5;margin:0 auto;">
<div style="height:50px;width:100%;">
<label class="user-label">用户名:</label>
<input type="text" class="username" name="username"/>
<div class="tishi-com">
<span class="tishi-font font-12"></span>
</div>
</div> <div style="height:50px;width:100%;">
<label class="user-label">手机号:</label>
<input type="text" class="phone" name="phone"/>
<div class="tishi-com">
<span class="tishi-font font-12"></span>
</div>
</div> <div>
<input type="submit" class="fade" value="提交" />
</div>
</div> <script type="text/javascript">
$(document).ready(function(){
$(".fade").click(function(){
var name=$.trim($(".username").val());
var phone=$.trim($(".phone").val());
if(name==""){
$('input[name=username]').siblings('.tishi-com').fadeIn();
$('input[name=username]').siblings('.tishi-com').find('.tishi-font').text('不能为空');
}
if(phone==""){
$('input[name=phone]').siblings('.tishi-com').fadeIn();
$('input[name=phone]').siblings('.tishi-com').find('.tishi-font').text('不能为空');
}
});
}); </script>
</body>
</html>

最新文章

  1. algorithm -- 基本介绍
  2. [Everyday Mathematics]20150221
  3. 再看Core Data中PSC陷入死锁的问题
  4. lua好久没有用了
  5. HTML-滚动字幕的源代码(可作滚动公告)
  6. java总结,错误集
  7. BCM策略路由交换芯片
  8. shell-逐行读取文件
  9. Open-Falcon 监控系统监控 MySQL/Redis/MongoDB 状态监控
  10. Python中使用hashlib进行加密的简单使用
  11. Echarts 中国地图各个省市自治区自定义颜色
  12. VMware卸载有残留,再安装时报错提示MSI Failed
  13. feign调用超时
  14. 由2个鸡蛋从100层楼下落到HashMap的算法优化联想
  15. Android开发 - 掌握ConstraintLayout(十一)复杂动画!如此简单!
  16. s6-2 UDP
  17. SQL Server2008 R2 数据库镜像实施手册(双机)SQL Server2014同样适用
  18. 前端获取的数据是undefined
  19. TCP如何保证可靠性
  20. linux上的工具或软件

热门文章

  1. jquery源码解析:val方法和valHooks对象详解
  2. [Objective-C语言教程]Posing(29)
  3. 十招谷歌 Google 搜索
  4. TPS和QPS定义以及影响TPS的因素
  5. Linux之du命令的使用
  6. 学习react教程
  7. logrotate运行时间指定
  8. 关于Vue中main.js,App.vue,index.html之间关系进行总结
  9. 封装 原生 fetch
  10. JavaScript数据结构-16.二叉树计数