javascript - detect not closed html tags in a text, and fix it -


i have html text called news generated ckeditor, may contain html tags bold, italic, paragraph and....
want choose first 100 characters of , show them users of app. choosing first 100 characters of news may cause choose html text has unclosed tags(the closing tags of html text may after character number 100).
there php or js function parse text , fix unclosed html tags or @ least remove unclosed html tags?

as far removing tags altogether, strip_tags function in php should trick.

strip_tags($input, '<br><br/>'); 

the second argument allowed tags (the ones don't stripped).


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -