I'm trying to set the character limit of a textarea field to 50 characters using only javascript. I CANNOT directly edit the HTML of the textarea field.
Here is the code I've attempted:
HTML
<textarea class="field-element " id="textarea-yui3" spellcheck="false"></textarea>
Javascript
<script>
document.getElementById("textarea-yui3").maxLength = "50";
</script>
This is not working. Any assistance would be appreciated.