SyntaxFix
Write A Post
Hire A Developer
Questions
You can also do this by passing function with onclick event
<a onclick="getColor(this);" color="red"> <script type="text/javascript"> function getColor(el) { color = $(el).attr('color'); alert(color); } </script>