John P. John P. - 1 month ago 9
Javascript Question

Populate Meta tag in Javascript

I am trying to get the data value in the meta tag below

<meta data-my-id="home">

So far i tried this, but this is actually returning the html.


Would someone be able to help me with it?


Using has attribute selector you can get the element with a certain attribute then get it's value using data() method.


or use attr() method