Reputation: 8463
How to fetch an element from getContent in tinymce using jquery
Upvotes: 1
Views: 255
Reputation: 50832
You cannot fetch an element from ed.getContent() that easily. You would have to parse the javascript string in order to do so.
I assume you want to access the image tag you were reffering to in your other question. This can be easily done onClick:
ed.onClick.add(function(ed, evt){
// Firefox
if (evt.explicitOriginalTarget){
if (evt.explicitOriginalTarget.nodeName.toLowerCase() == 'img'){
console.log(evt.explicitOriginalTarget); // this is the img-element
}
}
// IE
else if (evt.target) {
if (evt.target.nodeName.toLowerCase() == 'img'){
console.log(evt.target); // this is the img-element
}
}
}
Upvotes: 1