Pass variable to regular expression pattern string in jquery
- by phil
Is that possible to pass variable into regular expression pattern string in jquery ( or javascript)? For example, I want to validate a zip code input field every time while user type in a character by passing variable i to the regular expression pattern. How to do it right?
$('#zip').keyup( function(){
var i=$('#zip').val().length
for ( i;…