Bhavesh Patel
Bhavesh Patel

Reputation: 15

How to allow enter in textarea in php?

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

Answers (1)

Barmar
Barmar

Reputation: 782785

Include \n (newline) in the regexp:

$.validator.addMethod('special', function(value) {
    return value.match(/^[\n +,A-Za-z0-9_@./#-]+$/);
});

Upvotes: 1

Related Questions