jQuery.validator.addMethod("check_user", function(value, element) {
    var check = /^[A-Za-z\s]+$/;
    //this.optional(element)如果元素为空并且不需要,则立即返回true。
    return this.optional(element) || (check.test(value));
}, '必须是大小写字母或者空格');

rules: {
    user: {
        required: true,
        maxlength: 15,
        check_user:true,//自定义验证规则
    },
}

jquery 反转 dom元素

例: <ul> <li>A</li> <li>B</li> <li>C</li> </ul> 需要变成: <ul> <li>C</li>...

阅读全文

jquery-fancybox JavaScript图片库,支持pc,响应式

官网地址 http://fancyapps.com/fancybox/3/ document:http://fancyapps.com/fancybox/3/docs/#usage github https://github.com/fancyapps/fancybox 兼容性 ...

阅读全文

jquery 瀑布流插件 masonry

github https://github.com/desandro/masonry Masonry Cascading grid layout library Masonry works by placing elements in optimal position based on a...

阅读全文

欢迎留言