javascript - jquery value does't match format -


i validate input field , check if value not match time format 06:15 should .not statement?

($("#id").val().not.match(/^(2[0-3]|[01][0-9]):[0-5][0-9]$/)) 

you should not use .not in case.

the .not jquery function need selector, element or array parameter, eg:

$( "li" ).not( ":even" ); 

as mentionned arun p johny in comments, best way use logical not operator : ! perform logical negation on expression:

if(!$("#id").val().match(/^(2[0-3]|[01][0-9]):[0-5][0-9]$/)) {     //not matching regexp } 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -