I am attempting to extract HTML code from an iframe
and apply a background-color to the class: class="body"
The structure of my HTML source is as follows:
<iframe id="sc_ext_XT29EK" class="sc_ext" width="100%" height="1300px" frameborder="0" src="some-url" scrolling="no">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<body class="body">
....
</html>
I have made an attempt with jQuery code, but it did not yield the desired result.
<script type='text/javascript'>
$('iframe').load(function() {
$("iframe").contents().find(".body").css('background-color', 'red');
});
</script>
Initially, I tried to verify if the color change was effective. If successful, I aim to set the background-color
to none
.
Do you think this is achievable?
Thank you.