gpt4 book ai didi

javascript - $( "#tabs").tabs();不是函数

转载 作者:行者123 更新时间:2023-11-28 17:08:09 25 4
gpt4 key购买 nike

我将这段代码设置为创建一个选项卡式菜单,它显示为一个选项卡式菜单,但当我加载网站时,选项卡在单击时不会改变。在“检查元素”中它说
$( "#tabs").tabs();不是函数。我不知道下一步要解决这个问题。

<html lang="en"><head>
<meta charset="utf-8">
<title>jQuery UI Tabs - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$( "#tabs" ).tabs();
});
</script>
<style type="text/css"></style></head>
<body>

<div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" role="tablist">
<li class="ui-state-default ui-corner-top ui-tabs-active ui-state-active" role="tab" tabindex="0" aria-controls="tabs-1" aria-labelledby="ui-id-1" aria-selected="true" aria-expanded="true"><a href="#tabs-1" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-1">Title1</a></li>
<li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="tabs-2" aria-labelledby="ui-id-2" aria-selected="false" aria-expanded="false"><a href="#tabs-2" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-2">Title2</a></li>
<li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="tabs-3" aria-labelledby="ui-id-3" aria-selected="false" aria-expanded="false"><a href="#tabs-3" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-3">title3</a></li>
</ul>
<div id="tabs-1" aria-labelledby="ui-id-1" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-hidden="false" style="display: block;">
<h2>title1</h2>
<p>paragragh1</p>
</div>
<div id="tabs-2" aria-labelledby="ui-id-2" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-hidden="false" style="display: none;">
<h2>title2</h2>
<p>pargraph2
</p>
</div>
<div id="tabs-3" aria-labelledby="ui-id-3" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-hidden="false" style="display: none;">
<h2>title3</h2>
<p>paragraph3</p>
</div>

最佳答案

使用这个:

$.noConflict();
jQuery(document).ready(function($) {
alert("adsf");
$("#tabs").tabs();
});

$.noConflict() 解决了我的问题。

关于javascript - $( "#tabs").tabs();不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29859298/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com