John P. John P. - 1 year ago 131
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download