bootstrap tab opening wrong tab

I have a bootstrap tab on a form on my page.
http://du.thezone.org/apply.asp
if you leave the whole form blank, and just go to the last page and hit the finish button, after the alert message, it's supposed to bring me to the first tab again.
I tried both these methods which technically should work, but instead of showing me tab1 it's showing me tab2.
any idea what's wrong?
$('#rootwizard').find("a[href*='tab0']").trigger('click');

OR 

$('#rootwizard a[href="#tab1"]').tab('show');

Open in new window

rivkamakAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

contactkarthiCommented:
give a id='myTab' for your ul and use the following code and see

$('#myTab a:first').tab('show')
0
RobOwner (Aidellio)Commented:
Credit to contactkarthi but the following works on your site (tested with the built in dev tools)

$('#rootwizard a:first').tab('show')
0
rivkamakAuthor Commented:
the concept makes sense, so how come it's on my page and it's still bringing me to the second tab.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

RobOwner (Aidellio)Commented:
not sure what you mean... I go to the last page and instead of clicking your submit, i open the dev tools (F12) and put the code below into the console and press enter.  Goes to the first tab.

code you post the submit / validation failed code?  Can you confirm you have

$('#rootwizard a:first').tab('show')
0
rivkamakAuthor Commented:
My validation script looks like this:
function verify() {
var themessage = "You are required to complete the following fields: ";
if (document.form1.Name.value=="") {
themessage = themessage + '\n' + "First Name";
}
if (document.form1.Name2.value=="") {
themessage = themessage + '\n' + "Last Name";
}
if (document.form1.Address.value=="") {
themessage = themessage + '\n' + "Address";
}
if (document.form1.City.value=="") {
themessage = themessage + '\n' + "City";
}

//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields: ") {
document.form1.submit();
}
else {
alert(themessage);


$('#rootwizard a:first').tab('show') 
return false;
   }
}

Open in new window

0
RobOwner (Aidellio)Commented:
line 24 above , you're missing a semicolon at the end of the line.
0
rivkamakAuthor Commented:
Doesn't help the problem.
Anything else?

It's almost like something else it triggering it to go to step 2.
is there something else i can use to get to tab1 instead of this code?
0
RobOwner (Aidellio)Commented:
See if it makes a difference to delay the execution of selecting the tab

$('#rootwizard a:first').tab('show') ;

change to

setTimeout(function() { $('#rootwizard a:first').tab('show'); }, 500);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rivkamakAuthor Commented:
Somehow your answer made it work.
thank you
0
RobOwner (Aidellio)Commented:
What it tells me is the trigger is happening after your code that you've displayed here. An outfit of execution issue.

By using the setTimeout function you're just delaying the execution of that function call. But it's masking the real issue.

I'll have a look at your code again to see if we can find the source if the issue
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.