Invalid characters

Invalid characters

Hi


I am trying to check for invalid characters in two text areas in a form as shown below:

1.
<textarea type='text' rows="10" cols="100" name="comment" maxlength="1000" id='comment' required /></textarea>

2.


<textarea type='text' rows="10" cols="100" name="comment2" maxlength="1000" required id='comment2' /></textarea>


I am checking for invalid characters via this jquery function:


<script>
$(document).ready(function Val(){

if (/[*?]/.test($('textarea').val()) {
// do something
alert("Invalid characters found and not allowed.Please check");
}

})});
</script>


My question is how do I call the above function ?