Javascript name validation

后端 未结 3 1193
隐瞒了意图╮
隐瞒了意图╮ 2021-01-23 08:03

I have a javascript function written to validate a field on my form. This function is supposed to make sure the field is not empty, does not exceed the limit of 35 characters an

3条回答
  •  执念已碎
    2021-01-23 08:29

    UPDATED:

    Sorry, the problem is with your regex, i missed that, change to this its fully working:

      var ck_password =  /^[A-Za-z0-9-]/;
    
                if(!ck_password.test(stringf))
                {
    
                    alert("Family name can only contain alphanumeric characters and hypehns(-)")
    
                }
    

    Console in chrome, go to the OPTIONS in the right top coner, select TOOLS, then DEVELOPER TOOLS.

提交回复
热议问题