jquery實現(xiàn)提示語淡入效果
更新時間:2017年05月05日 17:01:29 作者:yangzailu1990
本篇文章主要介紹了jquery實現(xiàn)提示語淡入效果的實例,具有很好的參考價值。下面跟著小編一起來看下吧
效果圖:
話不多說,請看代碼:
<!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>
以上就是本文的全部內(nèi)容,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,同時也希望多多支持腳本之家!
相關(guān)文章
jquery中ajax函數(shù)執(zhí)行順序問題之如何設(shè)置同步
這篇文章主要介紹了jquery中ajax函數(shù)執(zhí)行順序問題之如何設(shè)置同步,需要的朋友可以參考下2014-02-02jQuery獲取this當(dāng)前對象子元素對象的方法
下面小編就為大家?guī)硪黄猨Query獲取this當(dāng)前對象子元素對象的方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-11-11jQuery flip插件實現(xiàn)的翻牌效果示例【附demo源碼下載】
這篇文章主要介紹了jQuery flip插件實現(xiàn)的翻牌效果,可實現(xiàn)類似卡羅牌翻頁的視覺效果,涉及jquery.flip.min.js插件的使用,并附帶demo源碼供讀者下載參考,需要的朋友可以參考下2016-09-09