简体   繁体   English

使用jQuery创建标签

[英]creating tabs using jquery

I'm trying to create tabs on my Content Page, but it does not work for me. 我正在尝试在内容页面上创建选项卡,但是它对我不起作用。 I've added the scripts to the Master Page 我已将脚本添加到母版页

<script src="Scripts/jquery-2.2.0.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-2.2.0.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.11.4.js" type="text/javascript"></script>

and then trying to add tabs on the Content Page: 然后尝试在内容页面上添加标签:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="AddMember.aspx.cs" Inherits="EOSProject.AddMember" %>

<asp:Content ID="Content1" runat="server" contentplaceholderid="MainContent">        
    <script type="text/javascript">
            $(document).ready(function () {
                $(" #tabs ").tabs();
            });
        </script>
        <div id="tabs">
            <ul>
                <li> <a href="#tabs-1"> First Tab </a> </li>
                <li> <a href="#tabs-2"> Second Tab </a> </li>
                <li> <a href="#tabs-3"> Third Tab </a> </li>
            </ul>
              <div id="tabs-1">
                  Tab1
              </div>
            <div id="tabs-2">
                Tab2
            </div>
            <div id="tabs-3">
                Tab3
            </div>
        </div>
</asp:Content>

is there something missing ? 缺少什么吗?

Thanks in Advance :) 提前致谢 :)

Well, I don't know what it looks like on your screen, but if I add jQuery, jQuery UI JS, and jQuery UI CSS, everything works. 好吧,我不知道它在屏幕上是什么样子,但是如果添加jQuery,jQuery UI JS和jQuery UI CSS,一切都会正常。

Here's a Fiddle . 这是小提琴

I would make sure you're referencing your scripts correctly, and are also including the CSS file for good measure.. 我将确保您正确地引用了脚本,并且还包括CSS文件,以备不时之需。

As a quick test, you can include these references and see if the tabs show up: 作为快速测试,您可以包括以下参考,并查看选项卡是否显示:

<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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