I am working on an page using jQuery tabs. The example shows how to set a cookie when a tab is selected. However, what I would like to do instead is to use a button to ask the user to make a conscious decision to select a particular tab as his/her default tab.
I've added a button to the content of each tab, with a value equivalent to the tab anchor value. For the moment clicking only displays an alert message.
Can someone help me to associate the button click with setting the cookie to the tab value. I've set up a jsfiddle to show what I am trying to accomplish. Any help would be greatly appreciated!!
http://jsfiddle.net/lbriquet/eLx2d/15/
$(function() {
$( "#tabs" ).tabs({
select: function(event, ui) {
window.location.replace(ui.tab.hash);
},
cookie: {
// store cookie for a day, without, it would be a session cookie
expires: 1
}
});
$(".my_button").click(function() {
alert($(this).attr("value"));
});
});