• 周二. 2月 27th, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

work_03_常见jq问题处理

admin

11月 28, 2021

1.获取不同浏览器按下的键码

$(document).ready(function(){
   $("#keydown").keydown(function(event){
        var keycode = (event.keyCod ? event.keyCode : event.which);
        console.log("keycode:" + keycode);
        }
    }) 
})    

2.输入卡号卡号规则***** **** **** ****** 中间有空格

$('#cardno').on('input', function () {
        //去掉所有空格
        this.value = this.value.replace(/s/g, "");

        if (/^[0-9]*[1-9][0-9]*$/.test(this.value)) {
            var len = this.value.length;
            if (len >= 6 && len <=9) {
                this.value = this.value.substring(0, 5) + " " + this.value.substring(5)
            } else if (len >= 10 && len <=13) {
                this.value = this.value.substring(0, 5) + " " + this.value.substring(5, 9) + " " + this.value.substring(9)
            } else if (len >= 14 && len <=20) {
                this.value = this.value.substring(0, 5) + " " + this.value.substring(5, 9) + " " + this.value.substring(9, 13) + " " + this.value.substring(13)
            }
        }
    })

《work_03_常见jq问题处理》有一个想法
  1. Sight Care is a daily supplement proven in clinical trials and conclusive science to improve vision by nourishing the body from within. The Sight Care formula claims to reverse issues in eyesight, and every ingredient is completely natural.

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注