0

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 this val()? Do I need to use html()?

I need the selector for this.

Tahir
  • 3,344
  • 14
  • 51
  • 69

2 Answers2

0

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

Do you have a live example/demo?

Alistair Laing
  • 983
  • 1
  • 7
  • 18
0

This might work:

jQuery("body", jQuery('#htmlData').val()).addClass("something");
lamelas
  • 872
  • 6
  • 15