Search code examples
javascriptprototypejs

IE8 change event listener on textarea not working


I have a page where I generate textareas via AJAX and fire events if those textareas are changed. This works great on IE9+ and other browsers such as Firefox, Chrome, Safari, etc. The problem is IE8 and under. They don't fire the change event. The code is:

Textarea looks like:

<textarea name="answer8158" id="answer8158"></textarea>

Javascript looks like:

document.observe('change', function(e, el) {
    if (el = e.findElement('textarea')) {
        //Do Something
    }
});

Is there a workaround to make the change event work? I would be fine with PrototypeJS or pure javascript solution.

Thanks.


Solution

  • The solution is to go back to hard coding the onchange events in the AJAX. Unfortunately the document observe (blur/change) doesn't work for IE8 and under. Not how I like to write code, but is the only solution I have found.