开发者

How to apply CSS on an element in innerHTML with jQuery?

I am using CKEditor. I have the html in a textarea. I want to get that HTML. And want to apply a class on the body tag in that markup.

jQuery('#htmlData').val() gives me the HTML.

How can I apply a class in the body tag present in th开发者_Go百科is val()? Do I need to use html()?

I need the selector for this.


jQuery(jQuery('#htmlData').val()).css('color','red');

Do you have a live example/demo?


This might work:

jQuery("body", jQuery('#htmlData').val()).addClass("something");
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜