Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use maxlength on textarea in struts 1 html tag

Tags:

tags

struts-1

In struts 1 tags for html:textarea here

I do not see a maxlength attribute. How can i restrict the user from entering more than 100 characters? Also why did struts 1 omit such a basic attribute?

like image 541
Victor Avatar asked Jan 13 '23 02:01

Victor


1 Answers

Add the attribute using JS.

Put something like this after your textarea:

<script type="text/javascript">
    document.getElementById('textarea-id').setAttribute('maxlength', '512');
</script>
like image 52
Mariusz Lipiński Avatar answered Jan 30 '23 01:01

Mariusz Lipiński