Jquery value does not match format
1 answer
In this case, you shouldn't use .not
.
A .not
jQuery function requires a parameter Selector
, Element
or Array
for example:
$( "li" ).not( ":even" );
As mentioned in Arun P Johny
the comments, the best way is to use the boolean operator NOT
: !
to perform boolean negation in your expression:
if(!$("#id").val().match(/^(2[0-3]|[01][0-9]):[0-5][0-9]$/)) {
//not matching with the regExp
}
0
source to share