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:
- $('table .personalForm2').each(
function(){
if ($(this).contains("<" or "> or "string" or "&"){
- $(this).val("");
- }else{
- //Do nothing
- }
}
- );
*cries*