create function and methods within it

create function and methods within it

I'm trying to create a function and methods within it.

What I want to do is to develop a form validation plugin.

I want to accomplish the following:

if ( $("#field_id").validate.isFullName() ) {
alert("is full name");
} else {
alert("is not full name");
}

what I've come up with is this:

$.fn.validate = {
   isFullName: function() {
      if ( $(this).val.match(/^[a-z]+$/i) ) {
         return true;
      } else {
         return false;
      }
   }
}


but it doesn't work. Does anybody know how I can fix that?[/code]