Jquery RegEx Validation

前端 未结 5 494
情书的邮戳
情书的邮戳 2020-12-31 10:52

I am wanting to check if an input field has the attribute \"pattern\" and if so, preform a regex check aganst said pattern.I know this is already done by HTML5, but I am wan

5条回答
  •  春和景丽
    2020-12-31 11:30

    Normally regular expression with javascript / jquery handle like

    var reg = /pattern/;
    if (reg.test($(this).val())) {
        // perform some task
    }
    

提交回复
热议问题