Micharch54 Micharch54 - 1 year ago 247
Javascript Question

jQuery append css link to iframe head

I'm trying to append a css file to an iframe that is created on a page from a global script. I can access part of it, but for some reason I can't append to the head. It's not throwing errors either, which is frustrating.

<script type="text/javascript">
$(document).ready(function() {
.append('<link type="text/css" rel="stylesheet" href="/include/outline.css" media="all" />');

Answer Source
var $head = $("#IFrame").contents().find("head"); 
var url = "Styles/styles.css";
$head.append($("<link/>", { rel: "stylesheet", href: url, type: "text/css" } ));


            color: 'purple'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download