jQuery - Assign a html code to a variable
Suppose I have a code like that
<p&开发者_开发问答gt;hello</p>
I want to assign the above code to a variable, how to do that?
var content = $('p').html();
Ah dammit, too late.
If you want a specific paragraph you should give it an id and use:
var content = $('p#id').html();
instead.
var a = "<p>hello</p>";
精彩评论