i have some HTML content in a database, and using impromptu as a light box to display some html content. where want it to be like
This is a Sample Text
but it displays as
<em><strong><span style="color: #ff6600;">This is a Sample Text</span></strong></em>
is there a way to convert the tagged text to the formatted text?
RTM, you can do this by using the html: method
You should be able to just write
$.prompt("<em><strong><span style='color: #ff6600;'>This is a Sample Text</span></strong></em>");
Reference: http://trentrichardson.com/Impromptu/
It is possible though that the HTML content in the database is converted to HTML characters references. See http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
Here's a simple function that doesn't depend on jQuery, which will convert it exactly like you are wanting:
function str_to_html(text)
{
var a = document.createElement('div');
a.innerHTML = text;
return a.textContent;
}
// This function will convert '<sometag>' to '<sometag>', causing the markup
// to be interpreted properly by the browser for your purpose.