我正在创建一个弹出窗口并希望向该弹出窗口添加CSS文件。下面是弹出窗口的代码。我有一个JavaScript可以创建一个弹出窗口。
<a href="popupwindowcontent.xhtml" title="Print" class="popupwindow">Print1</a>
现在我想将一个CSS文件添加到这个弹出窗口中。我尝试了以下代码:
$('.popupwindow').append('<link rel="stylesheet" href="css/style2.css" type="text/css" />');
$('head').append('<link rel="stylesheet" href="css/style2.css" type="text/css" />');
但是它不起作用。