Arjun
Arjun

Reputation: 11

Redirect from one tab to another tab

I am using Easy responsive tabs and trying to redirect to another tab in the same modal.How can i achieve this using jquery. Here is my code...

<div class="tab">
    <ul>
        <li class="resp-tab-item" aria-controls="tab_item-0" role="tab" ><span>LOGIN</span></li>
        <li class="resp-tab-item" aria-controls="tab_item-1" role="tab" ><span>REGISTRATION</span></li>                     
    </ul>
</div> 
<div class="tab-1 resp-tab-content" aria-labelledby="tab_item-0" id="tab1id">
    <div class="booking-form">
        <div class="online_reservation">
            <div class="b_room">
                <div class="booking_room"  >
                    <form  method="post" name="name" >        
                        <!-- TAB 1 CONTENTs -->
                        <div class="date_btn">                                        
                            <input type="submit" value="LOGIN" data-ng-click="submit()" >
                            <input type="submit" value="cancel" data-ng-click="cancel()" >
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="tab-2 resp-tab-content" aria-labelledby="tab_item-1" id="tab2id">
    <div class="booking-form">
        <div class="online_reservation">
            <div class="b_room">
                <div class="booking_room"  >
                    <form  method="post" name="name" >        
                        <!-- TAB 2 CONTENTs -->
                        <div class="date_btn">                                        
                            <input type="submit" value="LOGIN" data-ng-click="submit()" >
                            <input type="submit" value="cancel" data-ng-click="cancel()" >
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

Here, When i click on the cancel button from TAB1. I want to be redirected to TAB2 contents.

Upvotes: 1

Views: 844

Answers (2)

Bhuwaneswaran S
Bhuwaneswaran S

Reputation: 1

Current code:

<input type="submit" value="cancel" data-ng-click="cancel()" >

Replace with:

<a aria-controls="tab_item-1" role="tab">cancel</a>

Upvotes: 0

rohit raut
rohit raut

Reputation: 53

Have you write controller js for cancel()? If yes then use:

 $timeout(function () {
                    $('#status_tab').trigger('click');
                }, 100);

Here #status_tab is id of other tab.In your case take #tab2id. Try it this works fine in my code.

Upvotes: 1

Related Questions