Saint Robson
Saint Robson

Reputation: 5525

What's jQuery Method to 'Link' Data Between 2 Tabs?

I have a shopping cart page which contains 2 tabs.

tab #1 : user can manupulate it's content and rows. add quantity, subtract quantity or even remove the item.

tab #2 : confirm and show all products what user just ordered in tab #1.

now, the problem is, what's jQuery method to 'link' (or bind, or copy. I'm not sure what's the perfect word to describe it.) tab #1 and tab #2, so that when user manipulates data in tab #1, tab #2 will automatically shows it. thank you.

Upvotes: 0

Views: 45

Answers (1)

Shirin Safaeian
Shirin Safaeian

Reputation: 960

You need to bind first tabs fields change event to a method to retrieve form contents and update the second tabs fields like this:

$('#myFirstTabTextInputId').on('change', function (event){
     $('#mySecondTabTextInputId').val($(this).val());    
});

this code will copy your first tabs input text to second tab input when it's changed.

Upvotes: 2

Related Questions