Change the code for textarea change detection, hope to fix #495

Wow, thank you for your contributions already!
I changed the code to trigger on textareas only. The change detection works different for textareas: if you delete the text again, you won't be asked to confirm closing. Also, I used a method from a stackoverflow answer for the event handler, which should be a little more cross browser.