I have the following code: fiddle, how can I set it up so I can have urls to the different tabs, I have tried adding the tab id to the url and that doesn’t work. I have also tried anchors and that doesn’t work, any help appreciated.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do this very easy. As your list is corresponding to the tabs semself in the order of appearance you don’t need the ids and you can do it like this:
HTML
JavaScript
This is the line that adds the anchor to the URL:
Note, that this won’t work in the fiddle. Or you can leave this line out and add real urls like I did in the source code above.
I also optimized your code, in order that uses less selectors and it’s a little shorter. And it also uses a single class
activefor the current element (instead of applying a class to allinactiveelements). You just have to adjust your styles.I also added some CSS which shows the first element by default and hides all other – no JavaScript needed:
Fiddle
http://jsfiddle.net/insertusernamehere/hCWMj/