用jquery添加css文件 [英] adding css file with jquery

查看:135
本文介绍了用jquery添加css文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个弹出窗口,我想添加一个css文件到弹出窗口下面是popupwindow的代码。我有一个javascript创建一个弹出窗口。

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>



现在我想添加一个css文件到这个弹出窗口。我尝试了像

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" />');

但不起作用。

/ p>

Thanks

推荐答案

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

这应该可以工作。

这篇关于用jquery添加css文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆