When i run this $btns.first().click(); in the first function it doesnt action it where as if i click it (as per second function it works perfectly. The result is the slides all show when i click on a tab instead of just one. And then when i click one of the inner buttons the slides all disapear leaving just one. Which is correct.
I know this is hard to understand so hopefully the link helps.
When you define the
$tabs.click()function,$btnsdoesn’t actually exist, so it’s probably trying to click anundefinedreference. Just put the$tabs.click()function declaration below the instantiation of$btns.Also, when you click on a
$tabsit doesn’t update the screen correctly. Thereturncall in a function means that it leaves the function at that point. It will NOT continue through and run any other lines of code that exist after it. So, in your$tabs.click()declaration, you should move the last line ($btns.first().click()) above yourreturn false;statement.Finally, you might want to move the
$tabs.first().click()and$btns.first().click()lines, as they rely on the events being declared, and might not give you the results you want if they exist before the event declaration.