js get meta-tag name 1

js get meta-tag name

document.getElementsByTagName("meta").generator.getAttribute('version');

Here is what the above code is Doing:
1. We’re creating a new variable called “version” and setting it equal to the value of the “generator” meta tag.
2. We’re then using the “getAttribute” method to get the value of the “version” attribute of the “generator” meta tag.
3. We’re then using the “getElementsByTagName” method to get the “meta” tag.
4. We’re then using the “document” object to get the document object model.

Similar Posts