I have a textarea in my form. Now I want to enable a button once there is a change in the text of the textarea.
I tried using onchange event on the textarea, but, while using it, the browser wants me to click outside the textarea to enable the button, even though I changed some text in the textarea.
My requirement is to enable the button, the moment I change the text.
I have written this function onclick of the textarea:
function enableUpdateButton() {
document.getElementById("button").disabled = false;
}
What change should I do?
Use
onkeypress,onkeyuporonkeydownattribute on your textarea instead ofonchange. Theonchangeattribute is invoked when focus was changed from textarea to another element.