I am creating dynamically jQuery tabs. I want to assign the id to each tab.
$("#addTab").live('click', function() {
index++;
var title = 'Tab..... ' + index;
var url = '#fragment-' + index;
addTab(url, title, index);
$('li[class=ui-state-default]').id(this)=1; // this line to add id
});
but id is not assigning to the tab..
DEMO
NOTE:
$('li.ui-state-default').attr('id', 'some_' + index);was change all li’s id have classui-state-default, but current code will only change the last one’s id.