0

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

2
  • Seems like a part of your question is missing. Commented Dec 30, 2010 at 14:16
  • hmm your right, I check it out. Commented Dec 30, 2010 at 14:17

1 Answer 1

4
document.getElementById('tag1').getAttribute('metaDataAtt');
Sign up to request clarification or add additional context in comments.

3 Comments

Just tested it, works for Firefox. Does it work for IE also? It seems like it probably will.
I know this is a little old, but how do you set those attribute from JavaScript?
@Grae document.getElementById('tag1').setAttribute('metaDataAtt', 'foo');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.