Reputation: 15
I am using textarea in form in php.I have added validation through javascript function but it does not allow me to press enter key in textarea.I want to add to able enter key in textarea. What should i do?
<script type="text/javascript">
$.validator.addMethod('special', function(value) {
return value.match(/^[ +,A-Za-z0-9_@./#-]+$/);
});
</script>
Please help me. Thanks in advance....
Upvotes: 0
Views: 554
Reputation: 782785
Include \n
(newline) in the regexp:
$.validator.addMethod('special', function(value) {
return value.match(/^[\n +,A-Za-z0-9_@./#-]+$/);
});
Upvotes: 1