Reputation: 508
I'm following this example: Write Content To New Window with JQuery to popup a div in a new window. The problem is that I also need to include the css and script files.
Code:
var w = window.open();
var html = $("#modal").html();
$(w.document.body).html(html);
It works fine but looks ugly.
How can I add the css and the js script to the header?
This is working:
$(w.document.head).append('<link rel="stylesheet" href="plugin/flexigrid/css/flexigrid.pack.css" />');
But this is not:
$(w.document.head).append('<script src="plugin/flexigrid/js/flexigrid.js"><\/script>');
Upvotes: 0
Views: 129
Reputation: 4798
$(w.document.head).append('<link rel="stylesheet" type="text/css" href="styles.css">');
$(w.document.head).append('<script src="scripts.js"><\/script>');
Fiddle: http://jsfiddle.net/ypAsY/1196/
Upvotes: 1