How to foucs or auto select a jquery tab after javascript validation
Hi All,
I am using this below method to initialize the tab view.
$(function() {
$('#container-1').tabs();
});
JSP code piece :
<div class="tabcontainer">
<div id="container-1" >
<ul style="padding:1px;border-bottom:1px solid #8796A5;">
<li><a href="#fragment-1"><span>Tab 1</span></a></li>
<li><a href="#fragment-2"><span>Tab 1</span></a></li>
</ul>
<div id="fragment-1" >
<center>
<%@ include file='tab1.jsp'%>
</center>
</div>
<div id="fragment-2" >
<center>
<%@ include file='tab2.jsp'%>
</center>
</div>
</div>
</div>
while loading this JSP page i got the Tab 1 (Default selected) & Tab 2 view.
Scenario : I have a save button which is common to both the tabs. I entered some input fields in Tab 1 and trying to save the page. I am doing a validation in java script save button which checks the values in Tab 2... if it is empty I want to focus the Tab 2 to user.
Tried : For this scenario I tried $('#container-1').tabs(2); after my java script validation alert. Its not throwing any script error as well not working...
Can anyone help me to solve this issue...!
Thanks in Advance.