使用Jquery更改元标记 - 无法在视图源代码中看到它(Change meta Tag with Jquery - Cant see it in view sourcecode)

我更改了元数据的内容,如下所示:

$('meta[name=myMeta]').attr('content', 'newContent');

这工作和

console.log($('meta[name=myMeta]').attr('content'));

让我感到震惊的是'新内容'

但如果我现在点击“查看Sourcode”,我无法看到我用jquery做的更改。

我可以解决这个问题吗?

I change the content of a metatag like this:

$('meta[name=myMeta]').attr('content', 'newContent');

this works and

console.log($('meta[name=myMeta]').attr('content'));

resonses me the 'newContent'

but if i now click "View Sourcode" i cant see the changes i made with jquery.

Can i solve this some how?

最满意答案

在浏览器中查看源代码会显示从服务器下载的HTML。

要查看页面加载后对DOM所做的修改,您需要使用DOM检查器,通常可以通过按F12获得

Viewing the source code in the browser shows the HTML as it was downloaded from the server.

To see amendments you have made to the DOM after the page has loaded, you need to use a DOM inspector, usually available by pressing F12.

更多推荐

Sourcode,'content','meta,电脑培训,计算机培训,IT培训"/> <meta