JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/ui-lightness/jquery-ui.css">
<div>
<a href="http://www.yo.com#foo">Link</a>
</div>
JavaScript
var el = document.getElementsByTagName('a')[0];
var funcs = {
getAttr: function(ele, attr) {
var result = ele.getAttribute(attr) || ele[attr] || null;
if( !result ) {
var attrs = ele.attributes;
var length = attrs.length;
for(var i = 0; i < length; i++)
if(attr[i].nodeName === attr)
result = attr[i].nodeValue;
}
return result;
}
};
var result = funcs.getAttr(el, 'hash');
alert(result);