javascript - ie中的jquery标题选择器错误

标签 javascript jquery internet-explorer selector

为什么在 ie 中出现错误,当我尝试更改标题时。

$('title').text('new title');
or
$('title').html('new title');

在其他浏览器中工作正常。

顺便说一下,当我尝试使用以下代码获取 title 的值时,它工作正常。

alert($('title'));

有人知道为什么要这样做吗?为 ie 修复错误太烦人了。

最佳答案

您应该将 document.title 属性设置为普通字符串。

关于javascript - ie中的jquery标题选择器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7630062/

相关文章:

javascript - 将服务器响应数据设置为要使用的变量

javascript - 拖动时获取鼠标位置(JS + HTML5)

javascript - 带有基本 href 和查询字符串的 jQuery ui 选项卡不起作用

javascript - IE 错误触发点击 2 个按钮?

html - TD 的表格和空格的 IE 错误?

internet-explorer - 使用 Powershell 打开 Internet Explorer 并登录 Sharepoint

javascript - 谷歌浏览器 PDF 查看器 API?

javascript - D3.js 版本 3 中的 donut 气泡图

javascript - 如何修复从 json 文件导入时 undefined object 数组的变量?

javascript - Angularjs $http 在 IE9 中从本地磁盘加载数据问题