javascript - How do I parse TinyMce article content to find embedded images using JS -


I want to parse the content written in TinyMCE editor in the client side, I want to get all src attribute values ​​Image Editing editor editor is inserted (in the body of the article) in the field and stores them in the array.

How can I do this?

Thanks

(I tried:

  var arr = new array ($); $ (".txtEditorClass img"). Each (function () {Arr.push ($ (this) .attr ("Src")}};  

This was not working. I also used regular JS to see Had done a test:

var Arr = document.getElementsByTagName ("img"); for (var i = 0; i & lt; arr.length; i ++) {warning (Arr [i] .src);} where all images of images are shown outside the source value editor, but not images embedded in written text)

The TinyMCE editor is set in. And you need to tinyMCE.activeEditor.dom function to access iFrame internal elements. There is a need to use the .getRoot () (doc :)

function, so use something to recover all the images inside the editor:

  var Arr = new array (); $ (TinyMCE.activeEditor.dom.getRoot ()). Each (function () {arr.push ($ (this) .attr ("src"))});  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -