Opened 11 years ago

Closed 11 years ago

#8213 closed feature (wontfix)

finding tab by title

Reported by: mdibbets Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.tabs Version: 1.8.18
Keywords: Cc:
Blocked by: Blocking:


I have made a function that can make it possible to find the index of a certain tab.

	//a = string searchquery
	//b = be case sensitive or not. 'casesensitive' is yes, 'caseinsensitive' is no. Default is no
	//c = index location of of the tab if found. default is -1 and means not found.
	//d = [for loop]string with value of the tab title stripped of all html tags.
	//e = boolean with the result of b.
	//i = for loop iterator.
	var c=-1;
	var e=false;
	if(typeof b != 'undefined')
			case 'casesensitive':e=true;break;
			case 'caseinsensitive':e=false;a=a.toLowerCase();break;
			default: e=false;break;
	if(typeof a != 'undefined')
		for(var i = 0; i < $(this.lis).length; i++)
			var d = $(this.lis).eq(i).find("a").html().replace(/(<([^>]+)>)/ig,"");
				c = i;
	return c;

I'm using this myself to be able to find tabs that my php editor tool has generated, so that I don't open the same tab twice. This function returns the index of the tab found with the exact title. Options are available for case sensitivity. It works wonderfully on my code in different browsers.

Useage example:

window.alert($('#tabs').tabs().tabs('ispresent','Articles to edit','casesensitive'));

I bet you guys can improve my code in someway, but I know that a lot of people are dying for a feature like this.

Change History (1)

comment:1 Changed 11 years ago by Scott González

Resolution: wontfix
Status: newclosed

We already have two methods for finding tabs, we're not adding more. Build this as an extension.

Note: See TracTickets for help on using tickets.