本文主要介绍了jquery验证表单仿toast提示效果,实现代码简单易懂,非常不错,需要的朋友可以参考下,希望能帮助到大家。
HTML内容部分
-->
登录后复制
提示html及样式部分
#errormsg{ width: auto; height: 20px; padding: 1px 5px; text-align: center; background-color: #000; opacity: 0.5; color: #fff; position: fixed; left: 50%; margin-left: -50px; top: 93%; border-radius: 20px; }
登录后复制
jquery表单验证(正则表达式)
//验证手机号码 $("#MobilePhone").blur(function(){ var tel = $("#MobilePhone").val();//获取输入的手机号 var yidongreg = /^(134[012345678]d{7}|1[34578][012356789]d{8})$/; var dianxinreg = /^1[3578][01379]d{8}$/; var liantongreg = /^1[34578][01256]d{8}$/; if (yidongreg.test(tel) || dianxinreg.test(tel) || liantongreg.test(tel)) { $("errormsg").css({"display":"block"}); $("#errormsg").html("请输入正确号码").fadeIn(300).delay(2000).fadeOut(300); }else{ $("errormsg").css({"display":"block"}); $("#errormsg").html("请输入正确号码").fadeIn(300).delay(2000).fadeOut(300); } });
登录后复制
相关推荐:
ReactNative实现Toast的示例分享
使用toast组件实现提示用户忘记输入用户名或密码功能
微信小程序自定义toast实现方法详解
以上就是jquery表单验证仿Toast提示效果实例分享的详细内容,更多请关注【创想鸟】其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2789350.html