In the jquery below should there be a closing paretheses ")" before the "dot" in:
".test($ ..."?
(/^\s*$/.test($(this).val()))
$(document).ready(function () {
$('#userlogin').css('color', '#cccccc').val('LOGINNAME');
$('#userlogin').blur(function () {
if (/^\s*$/.test($(this).val())) {
$(this).val('LOGINNAME');
$(this).css('color', '#cccccc');
$(this).valid();
}
}).focus(function () {
if ($(this).val() === 'LOGINNAME') {
$(this).val('');
$(this).css('color', '#000000');
}
});
If not, why not? That code looks a little weird to me.
/something/is a regular expression. In Javascript they are objects with methods, andtestis one such method. There's nothing wrong with the code.