jQuery logo

I made a simple HTML page with JQuery UI tabs. But the customer asked to give URLs for each tab. I was a bit surprised with it, because I remember only how to make default tab on page load. You can do it with the syntax like this:

$("#tabs").tabs( { selected: x  });

 where 'x' is integer index of tab. So, the task was to determine which tab is requested.

I got the collection of tab links (a href='#') and got the values of its links. Also I parsed the URL and got the 'hash' value of URL. Hash has the value after '#'. After that I looked for whether the string of hash is contained in href attributes.

There are two parts of the code - Javascript and HTML. At first, Javascript:

The second part - HTML code - looks very coomon.