Stripping HTML tags out to leave text only.
Stripping HTML tags out to leave text only.

Hi, I have a personal localhost website and have HTML stored in one of my fields from the summernote editor. Is there anything already available to strip HTML tags out and render the field as Text without the Tags in the datatable?
I've started using the render ellipsis plugin which is cool for this field but the tooltip is pretty hard to read with the html tags present (as is the data in this particular column on the datatable)
This question has an accepted answers - jump to answer
Answers
Hi @PJ03029174 ,
There's not a renderer for that, but something like this works 99% of the time - see "Tiger Nixon" in the HTML.
Cheers,
Colin
Thanks Colin, that looks great. I'm using the
"render": $.fn.dataTable.render.ellipsis( 50,true,false )
code and have put
shortened = shortened.replace( /<.*?>/g, '' );
into the fn.dataTable.render.ellipsis() function.
Do you happen to know if I can use this code on the tooltip output? the tags are successfully removed from the datatable but when I hover over an ellipse value the tooltip still displays the tags.
Thanks a lot for the help. Pete
Hi @PJ03029174 .
Would you be able to change my example in that last post to show what you're got and done so far - it would help to understand what you have,
Cheers,
Colin
Hi Colin
I cloned your example and updated with my code, here
Thanks so much for the help!
Is this what you are looking for?
http://live.datatables.net/wolojoza/1/edit
Kevin
That worked a treat, thank you Kevin