Jquery RegEx Validation

前端 未结 5 498
情书的邮戳
情书的邮戳 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条回答
  •  梦毁少年i
    2020-12-31 11:47

    A string is not a RegExp object. You could use something like:

    var reg = new RegExp($(this).attr("pattern"));
    

提交回复
热议问题