If string contains string

If string contains string

Hi all, I have been trying for approximately 3 hours now on the same small problem.

I have a form with an amount of input fields.

Each input field has a class "personalForm2"

I want to check over all fields with class of personalForm2 to see if the value someone enters in is a "<" or a ">" or "script". Basically to validate those fields to make sure someone isn't trying to do the dirty on me.

Is there something along the lines of:

  1. $('table .personalForm2').each(
          function(){
                if ($(this).contains("<" or "> or "string" or "&"){

  2.                   $(this).val("");
  3.             }else{
  4.                   //Do nothing
  5.             }             
          }
  6. );
*cries*