通过jQuery改变一个css链接的href [英] change the href of a css link via jquery
本文介绍了通过jQuery改变一个css链接的href的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<head>
<link href="foo.css" rel="stylesheet" type="text/css" />
</head>
我可以通过jquery将此链接的href从 foo.css
to bar.css
can I via jquery change the href of this link from foo.css
to bar.css
推荐答案
Html:
<head>
<link id="test" href="foo.css" rel="stylesheet" type="text/css" />
</head>
<body>
...
</body>
和jQuery:
And the jQuery:
$(document).ready(function() {
$("#test").attr("href", "bar.css");
});
这篇关于通过jQuery改变一个css链接的href的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文