Given any arbitrary text file full of printable characters, how can this be converted to HTML that would be rendered exactly the same (with the following requirements)?
Is is very simple if you use jQuery library in your project.
Just one line ,Add asHTml
extenstion to String Class and :
var plain='<a> i am text plain </a>'
plain.asHtml();
/* ' i am text plain ' */
DEMO :http://jsfiddle.net/abdennour/B6vGG/3/
Note : You will not have to access to DoM . Just use builder design pattern of jQuery
$('
')