0

I've try this code for Iframe code css but it dosen't working... can you suggest me how to apply css for iframe..

window.onload = function() {
   let myiFrame = document.getElementById("myiFrame");
   let doc = myiFrame.contentDocument;
   doc.body.innerHTML = doc.body.innerHTML + '<style>.form_generater_form_div .block_label {font-weight: bold !important;}</style>';
}

OR

$("#myiFrame").on("load", function() {
  let head = $("#myiFrame").contents().find("head");
  let css = '<style>.form_generater_form_div .block_label {font-weight: bold !important;}</style>';
  $(head).append(css);
});
InSync
  • 4,851
  • 4
  • 8
  • 30
  • Manipulating the content of the iFrame will only work, if the content comes from the same domain as your script that is manipulating the content afaik. – Lapskaus Apr 18 '23 at 08:40
  • Does this answer your question? [How to apply CSS to iframe?](https://stackoverflow.com/questions/217776/how-to-apply-css-to-iframe) – Brett Donald Apr 19 '23 at 04:45

0 Answers0