How to Use jQuery as a tab Interface

Source: Internet
Author: User

The option card interface is one of the UI components with large local desktop applications. Fortunately, jQueryUI makes them easy to implement. The following describes how to make them start quickly and run properly.

The basic structure of HTML is as follows:

<Div id = "tab_wrapper"> <ul> <li> <a href = "# tab1"> Tab 1 </li> <a href = "# tab2"> Tab 2 </li> </ul> <div id = "tab1"> Tab 1 content here... </div1> <div id = "tab2"> Tab 2 content here... </div1> </div>

Use a div with a single ID to specify these anchors as labels. The tag list is displayed on the webpage tab. When you click a link, it selects this tab. Only a short line of jQuery code can convert this HTML into an option-style interface:

$ (Function () {$ ("# tab_wrapper"). tabs ();});

More concise code! We can even implement further functions. This document shows more functions, but I think it is most useful to load data from external sources. By using the anchor point to the ID of another page, instead of the project on the screen, it automatically loads resources when you click the tab and the content is loaded through AJAX. The Demo code shows that you can easily handle errors on servers with the rollback function.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.