I am using TinyMCE editor.Everything I write inside the editor is placed in p tag. But when I click the equation tool from toolbars,a dynamically span having class AMedit is created inside the p tag.My question is how to do some stuff or more simple just alert something when I focus the newly created span.Remember that the this span is contenteditable and also the whole editor comes from an Iframe.
Please have a look at the following link.
http://www.imathas.com/editordemo/demo.html
I have written the following code but id does not work for me.What is the error in my code.
var span = $("#elm1_ifr").contents().find("span.AMedit");
var canPressEnter = true;
span.on("focus", function(){
canPressEnter = false;
}).on("keypress", function(e){
var code = (e.keyCode ? e.keyCode : e.which);
if (canPressEnter === false && code === 13)
{
alert('welcome');
}
}).on("blur", function(){
canPressEnter = true;
});
})
Please anyone can explain with a simple example.