in my web page I have a meta
<meta name="version" content="2.42">
I would like to output the value of the content attribute somewhere in the page to avoid having two times the same value somewhere in the code. Like
<p>© Copyright 2020, Ver. myVersionNumber</p>
and myVersionNumber should be a reference to the content attribute of the meta "version". How could I achieve this?
Thanks in advance and best regards
You can access the meta tag value using JavaScript:
const versionElem = document.querySelector('meta[name="version"]');
document.getElementById('version').textContent = versionElem.content;
<meta name="version" content="2.42">
<p>© Copyright 2020, Ver. <span id='version'>myVersionNumber</span></p>