Hello All -
I've been doing a lot of php but - due to a client request - am now thrown in to the deep end regarding some jquery functionality.
I've partially got this little script working, but am stuck on the conditional syntax involved in checking a form field's content against a regular expression.
I've put ***what I think*** is the problem area in bold.
Be aware that I know the regular expression I'm using is not correct for checking 2 words with a space... the error I keep getting (and can't figure out) reads: "$("input#name").search is not a function".
There may be other issues as well but the above is what I'm stumbling on right now.
If anyone can assist me, I'd be HUGELY grateful!
Here's the code:
<script type="text/javascript">
$(document).ready(function(){
//Check Full Name Field
$('input#name').blur(function() {checkName(); });
});
function checkName()
{
var firstLast=/(\b[A-Za-z]+\b.*){2,}/
if($('input#name').search(firstLast)){
$('input#name').css('background-color','#FFCCCC');
$('span#eName').css('visibility','visible');
//return false;
}
else {
$('input#name').css('background-color','#E4FFCA');
$('span#eName').css('visibility','hidden');
//return true;
}
}
</script>