How can I return the anchor tags' data-test
value so I can use this function on anchors with different data-test
values?
<a href='#' data-test='some text'></a>
function getAnchor(){
// do stuff
console.log($(this).data('test'));
}
$('a').on('click',function(e){
e.preventDefault; //prevent anchor behaviour.
getAnchor();
});