You may want to review the .getItem(). I would suggest the following:
function getData(i){
return localStorage.getItem(i);
}
Then you can use it like so:
active: function(event, ui){
ui.newPanel.html(getData("#" + $(this).context.id + "-current-index"));
}
Update
activate( event, ui ) Type: tabsactivate
Triggered after a tab has been activated (after animation completes). If the tabs were previously collapsed, ui.oldTab and ui.oldPanel will be empty jQuery objects. If the tabs are collapsing, ui.newTab and ui.newPanel will be empty jQuery objects.
See More: https://api.jqueryui.com/tabs/#event-activate
ui.newPanel is the jQuery Object that represents "the panel that was just activated." So we can then use .html() on that object.
.html( htmlString )
Description: Set the HTML contents of each element in the set of matched elements.
See More: https://api.jquery.com/html/