jQuery data attribute event
by Oliver Kelso
HTML
<a data-sc="download_something" href="http://test.com/test/1" title="test link 1">test link 1</a>
<a data-sc="download_something" href="http://test.com/test/2" title="test link 1">test link 2</a>
<a data-sc="download_something" href="http://test.com/test/3" title="test link 1">test link 3</a>
<a data-sc="download_something" href="http://test.com/test/4" title="test link 1">test link 4</a>
<a data-sc="download_something" href="http://test.com/test/5" title="test link 1">test link 5</a>
JavaScript
$(document).ready(function(){
$('a[data-sc^="download_"]').on('mousedown', function(e){
var href = $(this).attr('href');
var title = $(this).attr('title');
console.log(href + " " + title);
});
});