28
rated 0 times
[
32]
[
4]
/ answers: 1 / hits: 32949
/ 10 Years ago, sun, june 1, 2014, 12:00:00
Just trying to use javascript's regex capabilities with the .test()
function.
var nameRegex = '/^[a-zA-Z0-9_]{6,20}$/';
if(nameRegex.test($('#username').val())) {
...
}
The error is on this line if(nameRegex.test($('#username').val())) {
Debugger breaks there and says Uncaught TypeError: undefined is not a function. It seems like .test()
is not defined? Shouldn't it be?
More From » jquery