0

I use Jquery UI to create tabs. I want create new tabs with content tab1 = content tab2

1 Answer 1

1

You can use a bit of jQuery to accomplish this. Assuming that your jQuery UI tags code looks like:

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">Tab 1</a></li>
        <li><a href="#tabs-2">Tab 2</a></li>
    </ul>
    <div id="tabs-1"></div>
    <div id="tabs-2">Test content</div>
</div>

You can use something similar to the following to copy the content into the first tab.

var content = $('#tabs-2').html();
$('#tabs-1').html(content);

This code takes the HTML string within the tabs-2 div and stores it in a variable. It then sets the content in tabs-1 div to the variable.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.