jaredreich / pell

📝 the simplest and smallest WYSIWYG text editor for web, with no dependencies
MIT License
11.95k stars 549 forks source link

Hi ! There's way to get div id on onChange event ? #203

Open Simerca opened 4 years ago

Simerca commented 4 years ago

Hi, There's way to obtain div id on onChange event ? i use this thing

for(var i = 0; i < elements.length; i++){ this.pellConfig.element = elements[i]; this.pellConfig.onChange = function(e){ console.log(e); } pell.init(this.pellConfig) }

xch1029 commented 3 years ago

maybe you can try this:

const onChange = (id, html) => {
    console.log(id, html);
};
for(var i = 0; i < elements.length; i++){ this.pellConfig.element = elements[i]; this.pellConfig.onChange =onChange.bind(this,elements[i].id ) ; } pell.init(this.pellConfig) }