jquery实现提示语淡入效果
网络编程 2021-07-04 18:32www.168986.cn编程入门
本篇文章主要介绍了jquery实现提示语淡入效果的实例,具有很好的参考价值。狼蚁网站SEO优化跟着长沙网络推广一起来看下吧
效果图:
话不多说,请看代码:
<!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>
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持狼蚁SEO!
编程语言
- socket网络编程 socket网络编程Socket基础
- 少儿编程培训班 少儿编程培训班教学方法
- linux系统编程:Linux系统编程多线程基础
- unix环境高级编程 首发于 UNIX环境高级编程学习之
- 学编程学哪一种比较好 初学者哪种编程语言比较
- 学PLC编程学费多少
- 计算机编程入门 学计算机编程入门的初学指南
- 世界编程语言排行榜
- vba编程培训:Excel VBA编程培训初学者教程
- 少儿编程课程:少儿编程学什么及各年龄段如何
- 游戏编程入门:少儿游戏编程入门的技巧
- 学编程哪个培训机构好 编程培训机构哪个好
- 编程机器人加盟 机器人编程加盟哪家好
- 在线少儿编程机构排名
- 电脑编程入门自学
- 服务器系统下载:服务器系统的安装