简体   繁体   中英

How do you access non-standard attributes in Firefox JavaScript?

Basically in IE you can do something like this:

<img metaDataAtt="type5" src="..." id="tag1"/>

and then in the JavaScript do something like

var theImg = document.getElementById("tag1");
alert(theImg.metaDataAtt);

However, in firefox you can't. Is there some sort of hack to get around this?

Thanks, Grae

document.getElementById('tag1').getAttribute('metaDataAtt');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM