TLDR When clicking on a link I want to assign a cookie with a name of instrument and a value of the text on the link clicked.
Using Jquery.1.4.2.min
Using the answer from Zack above I changed the element tag. The only issue is it will set the cookie for whichever link is followed wether it be for the link I want or not but it sets the cookie and works for where it is needed. IF there is a cleaner approach it would be appreciated.
$(document).ready( function() {
$('a[href="page.html"]').each( function() {
// Kill the link's link feature.
_href = $(this).attr('href');
$(this).attr("rel", _href).attr("href", "javascript:void(0);");
});
$('a').click(function() {
var name = 'instrument';
var value = $(this).text();
$.cookie(name, value, { expires: 365 });
// Go places
document.location.href = $(this).attr('rel');
});
});
Massive thanks to Sarfraz and Zack for all the help at least I have something that works for now ^^