摘要: js代码: 个人感觉比较好用,可以用validate框架验证元素。 阅读全文
posted @ 2017-05-11 10:34 微笑Tears 阅读(21832) 评论(1) 推荐(0) 编辑
摘要: 方法一: 1 <label for="checkIn" class="error"></label> 这一行代码就可以把不和规则时的提示扔到你想要的任何地方其中for后面跟着的是单选或者是多选框的name, class不能修改必须为error才可以。 其原理是当验证出问题时候,jQuery Vali 阅读全文
posted @ 2017-05-11 10:22 微笑Tears 阅读(7879) 评论(0) 推荐(0) 编辑
摘要: 方式一:event.stopPropagation(); 1 $("#div1").mousedown(function(event){ 2 event.stopPropagation(); 3 }); 方式二:return false; 1 $("#div1").mousedown(functio 阅读全文
posted @ 2017-05-11 10:17 微笑Tears 阅读(47165) 评论(0) 推荐(2) 编辑
摘要: 效果图: 根据身份证号自动写入出生年月 身份证号码校验: js代码部分: 页面元素的验证是基于jquery validate框架 阅读全文
posted @ 2017-05-11 10:02 微笑Tears 阅读(2937) 评论(0) 推荐(0) 编辑
摘要: 比如<select class="selector"></select> 1、设置value为pxx的项选中 $(".selector").val("pxx"); 2、设置text为pxx的项选中 $(".selector").find("option[text='pxx']").attr("sel 阅读全文
posted @ 2017-05-11 09:17 微笑Tears 阅读(155) 评论(0) 推荐(0) 编辑