我正在尝试在单击按钮时更改链接标签的 href 属性。但是我无法实现它。它给我一个错误样式表https://www.w3resource.com/没有加载,因为它的 MIME 类型“text/html”不是“text/css”。请帮忙,我的代码如下
$(document).ready(function() {
$('#button1').click(function() {
$("#styleit").attr('href', 'https://www.w3resource.com/');
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="a.css" rel="stylesheet" id="styleit">
<p><input id="button1" type="button" value="Click to see the actual url" /></p>