Has anyone successfully used the jquery plugin wysiwyg ver 0.97 to call an event handler when the contents of the edit control changes?
I'm calling wysiwyg like this
$("#practice_form_text .wysiwyg").wysiwyg({
events: {
change: function(event) {
return alert("changed");
}
}
});
The alert message is never displayed. Any ideas to try would be greatly appreciated.
Thanks, Russ
Didn't find any method on the documentation to use the change event, non the less, here is a useful approach:
HTML
<textarea id="wysiwyg" rows="5" cols="103"></textarea>
JQUERY
// initialize the wysiwyg
$("#wysiwyg").wysiwyg();
// bind the event event
$('#wysiwyg').wysiwyg('document').keypress(function(e) {
// This will cancel the keypress
e.preventDefault();
// alert
alert('Keypress detected!');
});
And a nice demo Fiddle here!