adding css file with jquery

I am creating a popupwindow and I want to add a css file to that popupwindow below is the code for popupwindow. I have a javascript with creates a popupwindow.

<a href="popupwindowcontent.xhtml" title="Print" class="popupwindow">Print1</a>

Now I want to add a css file to this popupwindow. I tried something like

$('.popupwindow').append('<link rel="stylesheet" href="css/style2.css" type="text/css" />');


 $('head').append('<link rel="stylesheet" href="css/style2.css" type="text/css" />');

but doesnt work.

Thanks

56
задан Jay 15 April 2011 в 18:21
поделиться