Reputation: 713
I have a textarea where it only allows 150 characters how do I make the focus go from the textarea to the error message after a user exceeds the maximum number of characters.
Upvotes: 1
Views: 6757
Reputation: 470
You must set an identity for the element and then execute document.getElementById('elementId').focus()
.
If you have troubles with double used id's, then declare a global variable with a sequence number and increase this number (and use it as part of the element id) every time.
Upvotes: 4