我正在尝试更改我们的网站,以使用 .load() 函数通过 jquery 加载 header ,但为此我需要设置页面的标题。
从另一个 StackFlow 问题中,建议做一些简单的事情
$(document).ready(function() {
document.title ='Name Changed to Protect the Innocent';
});
当我这样做时,我收到了 Firebug 错误
Missing } in XML Expression
对于脚本中的该行
我确信可能有一个简单的解决方案,但我肯定没有想到。
最佳答案
我刚刚对此进行了测试 here ,请查看您是否以相同的方式创建了 html 文档。代码如下。
<html>
<head>
<title>Old Title</title>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
document.title ='Name Changed to Protect the Innocent';
});
</script>
</body>
</html>
关于javascript - XML 表达式中缺少 },我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4315233/