Skip to content
Advertisement

How to get Raw html from string in jquery?

I have <label class='ash'>Comment Removed</label> in the database.

When I show this on the grid. I get this on the page:

JavaScript

Actually I should just get Removed in Gray color

How can I convert this to Html like I do in MVC 3 Razor view?

JavaScript

I am using jquery 1.6 on MVC 3

I tried:

JavaScript

May be it is simple, but can’t figure it out

Advertisement

Answer

This should do the trick for you:

JavaScript

Here’s a demo showing it being appended to the body ->

If you need to do this multiple times, you could simplify with a function, like so:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement