0

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>');
Community
  • 1
  • 1
Martin
  • 510
  • 1
  • 6
  • 15

1 Answers1

1
$(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/

Kristoffer Jälén
  • 4,112
  • 3
  • 30
  • 54