简体   繁体   中英

jQuery UI Tabs Ajax - only first tab displaying loaded content

I have a set of jQuery UI tabs, which load their content via the ajax method:

<div id="tabs">
    <ul>
        <li><a href="/messages/inbox" title="Inbox"><span>Inbox</span></a></li>
        <li><a href="/messages/sent" title="Sent"><span>Sent</span></a></li>
        <li><a href="/messages/inbox" title="Ins"><span>Ins</span></a></li>
    </ul>
    <div id="Inbox"> ... </div>
    <div id="Sent"> ... </div>
    <div id="Ins"> ... </div>
</div>

JS:

$(document).ready(function () {
    $("#tabs").tabs();
}

The tab titles are displayed, and the content of the first tab is loaded OK.

Using the AJAX Tabs method is detailed here

When I switch to a different tab, I can see the browser loads the content for that tab, but the content isn't displayed.

Any ideas what I am missing?

replace your ul list by this :

 <ul>
        <li><a href="#Inbox" title="Inbox"><span>Inbox</span></a></li>
        <li><a href="#Sent" title="Sent"><span>Sent</span></a></li>
        <li><a href="#Ins" title="Ins"><span>Ins</span></a></li>
    </ul>

Have fixed it now. I had a subsequent $.ajaxSetup() call that was upsetting things.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM