Save jqxTabs selection with Cookies

1. Before the jqxTabs initialization, check for a saved index. If there’s index, set the jqxTabs ‘selectedItem’ property to point to the index.
var index = $.jqx.cookie.cookie("jqxTabs_jqxWidget");
if (undefined == index) index = 0;
$('#jqxTabs').jqxTabs({selectedItem: index, width: '90%', height: 200, position: 'top', theme: theme });
2. After the initialization, use jQuery to select the jqxTabs DIV tag and bind to the ‘selected’ event. In the event handler, save the selected index in a cookie.
// bind to the select event.
$("#jqxTabs").bind('selected', function (event) {
// save the index in cookie.
$.jqx.cookie.cookie("jqxTabs_jqxWidget", event.args.item);
});

About admin


This entry was posted in JavaScript, jQuery, jqxTabs and tagged , , , , , , , , , , , , , . Bookmark the permalink.



Leave a Reply