JavaScript和jQuery
记录自己的学习过程和工作中遇到的问题
猫弦丿
这个作者很懒,什么都没留下…
展开
-
限制input只能输入正整数
限制input只能输入正整数 <input type="text" autocomplete="off" name="title" class="matTopR_p_input" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"/> onkeyup:会在键盘按键被松开时触发; onafterpaste:粘贴触发原创 2021-02-28 17:15:28 · 896 阅读 · 0 评论 -
刷新指定的iframe页面
刷新指定的iframe页面 在用iframe做后台管理系统时,经常会有刷新指定页面内容的需求,参考网上的都是父子页面之间的操作,没有对指定页面(或者兄弟页面)做操作或刷新,现总结一下刷新指定iframe页面怎么做。 1.A页面 //获取iframe页面的id function getIframeByElement(element){ var iframe; $("iframe", window.parent.document).each(function(){ if(elem原创 2021-01-05 12:02:22 · 1434 阅读 · 0 评论 -
bootstrap插件bootstrapValidator常用验证规则及常用方法总结
bootstrap插件bootstrapValidator常用验证规则总结 1.判断字段是否为空 notEmpty: { message: ‘用户名必填不能为空’ } 2.字段长度判断 stringLength: { min: 6, max: 30, message: ‘用户名长度不能小于6位或超过30位’ } 3.通过正则表达式进行验证 regexp: { regexp: /1+$/i, message: ‘名字只能由字母字符和空格组成。’ } 4.大小写验证 stringCase: { message:原创 2020-09-03 16:22:46 · 1559 阅读 · 0 评论 -
attr 和 prop 的区别
关于attr() 和 prop() 的区别 在我们用jQuery来写代码的项目中,会经常用到要给元素设置属性的时候,而通常我们也是用attr()和prop()方法;但是attr()和prop()是有区别。 1、对于 HTML 元素本身就带有的固有属性,在处理时,使用 prop 方法。 prop()函数的结果: 1.如果有相应的属性,返回指定属性值。 2.如果没有相应的属性,返回值是空字符串。 例如: <a href="https://www.runoob.com" target="_self" cla原创 2020-07-05 16:30:15 · 543 阅读 · 0 评论