- Attribute of
- HTML5 Textarea Attributes: Here's What You Should Know
- What does
<form> <textarea onchange="alert('You just changed the textarea.')" placeholder="Type in this box. When you click away an alert will be generated."> </textarea> </form>
What Can We do with
textarea, this happens when the content of the
textarea is modified and then the
textarea loses focus because the user clicks away or presses the tab key.
onchange element could be used on a
textarea to launch a script after the user finishes filling in the field. The script could do something like enable the form submit button or enable a follow-up field that shouldn’t be completed until the
textarea has received input.
oninput. The difference is that
oninput is triggered every time the value of an element changes even while it still is in focus. So, if we were to substitute
onchange in the
textarea code in the example above, we’d get the following rather annoying alert-generating