Change meta tag with Jquery - Cant see it as source

I am changing the content of the metatag as follows:

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

      

it works and

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

      

changes me 'newContent'

but if now I click on "View Sourcode" I cannot see the changes I made with jquery.

Can I solve this problem how?

+3


source to share


2 answers


Viewing the source code in a browser reveals the HTML that was downloaded from the server.



To view the changes made to the DOM after the page has loaded, you need to use the DOM inspector, usually accessible by clicking F12.

+3


source


You are confusing page source with DOM.

Source is the original content supplied from the server, it will not change.



The DOM is a live version of the source, this can be changed with javascript. In Chrome, you can view this by right-clicking on the page and choosing Inspect Item.

+1


source







All Articles