To do this i use mootools, a very fast and handy JavaScript framework.
Imagine that you got an element as following:
<img id="image" src="..." aaa="true" />
To get the value attribute “aaa” using mootools you only need to do the following:
$("image").getAttribute("aaa");
This solution will work in all browsers.
In that line, the only thing you need mootools for is getting the element.
You don’t need to include an entire framework to do that… try:
document.getElementById(’image’).getAttribute(’aaa’);
Native javascript FTW!!!
Oh, if you reeeeeeally like that dollar function:
function $(id) { return document.getElementById(id); }
There.
You actually right. I don’t know how i didn’t see that. Or was because it was 5 a.m when i wrote this post, or it’s to much mootools….
Thanks for the correction André