I am getting an iframe
, in which I am finding an element. I tried to add a keyup
event with editable
div, but it's not working...
Here is the code:
var iframebody = $(editorid).siblings().find('iframe').contents().find('body');
var div = $('<div />',
{text:textstring,
class:'txtMsg mceNonEditable',
"data-mce-contenteditable":"false",
css:{'background':'#f2f2f2','margin-bottom':'5px'}});
var msgDiv = $('<div />',
{html:msgText,class:'msgText mceEditable',
"data-mce-contenteditable":"true",
css:{'margin-bottom':'5px','outline':'0'}})
.keyup(function(){
console.log('keyup'); //not working
});
var appender = iframebody.append(div).append(msgDiv);
console.log(iframebody.find('.mceNonEditable').get(0)); //i am getting the object.
iframebody.find('.mceNonEditable').on('keyup', function () {
console.log('hi'); //not working!
});
Can anyone explain why this approach isn't working?