steveathon / bootstrap-wysiwyg

Tiny bootstrap-compatible WYSIWYG rich text editor
MIT License
661 stars 1.71k forks source link

Is there an "on change" event? #27

Closed rashandzamshut closed 9 years ago

rashandzamshut commented 9 years ago

I need a callback function to run each time html within editor changes - when user types, pastes, cuts, clicks buttons. I tried the obvious code below, but my console didn't log any messages. How do I do this?

$('#bootstrapWysiwyg').change(function(){
    console.log('CHANGED');//not triggered
});

$('#bootstrapWysiwyg').on('change', function(){
    console.log('CHANGED');//not triggered
});

$('#bootstrapWysiwyg').wysiwyg();//INSTANTIATING (and it actually works)

$('#bootstrapWysiwyg').change(function(){
    console.log('CHANGED');//not triggered
});

$('#bootstrapWysiwyg').on('change', function(){
    console.log('CHANGED');//not triggered
});
rhpot1991 commented 9 years ago

There is a change event you can use:

https://github.com/steveathon/bootstrap-wysiwyg/blob/master/examples/events.html

rashandzamshut commented 9 years ago

This seems to be browser specific. In Chrome, instead of "change" I had to use "input". Would be nice if this plugin had some built-in abstraction over this, but for now I think this issue should be closed.