on() "mousedown" isn't working anymore. What am I doing wrong?
Hi
On my site I want to change the href on all itunes links into a shorturl. I use this code. I think it worked before, but now it seems it has stopped working. Not sure why. No errors in log. Maby there's a more elegant solution (that's working)?
- jQuery(document).ready(function() {
- jQuery("body").on('mousedown', 'a[href*="itunes.apple.com"]', function() {
- var l = jQuery(this).attr('href');
- if (l.match(/id(d{3,25})/g)) {
- jQuery(this).attr('href','http://tinyituneslink.co.uk/'+RegExp.$1);
- }
- });
- });