I am trying to identify the texts from CKeditor.
The ckData contains html markup and tables from Ckeditor that is input from users.
For example
text here texts here texts here
second line texts...etc.
<br>
<table>
...
</table>
more texts here...
<table>
....
</table>
I want be able to get all texts from the ckData.
I can get table texts with the following codes
var contents = {};
var temp = document.createElement('div');
var instance = this;
temp.innerHTML = ckData;
var tables = temp.getElementsByTagName('table')
//use tables as array...
for(var i = 0; i<tables.length; i++){
var table = tables[i];
contents.rowsCount = $('tr', table).length;
contents.columnsCount = $('td', table).length / question.rowsCount;
contents.texts='';
$(table).find('td').each(function(){
contents.push($(this).text().trim());
contents.texts += $(this).text()
})
}
I want to be able to extract texts outside of table WHILE maintain the original order of the ckData.
so the final contents variable I was hoping to get is like:
first part of texts
table cell data //got this
second part of texts
table cell data //got this
I got the table cell data but I am not sure how to get the texts outside of table structure.
I hope I explain it well. Thank you so much for the help!