开发者

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>";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜