gpt4 book ai didi

javascript - jQueryUI 不在页面中加载

转载 作者:行者123 更新时间:2023-11-30 20:38:01 25 4
gpt4 key购买 nike

:-)

我今天早上遇到了这个问题。

我想尝试对列表使用 jquery-ui 方法调用 .sortable() 但我遇到了这个问题。当我在 console.log 中加载页面时,我可以看到:ReferenceError: $ 未定义。

这里是代码:这是

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Sovversivi e Partigiani - Back-end - Gestione Sovversivi</title>

<script defer src="https://use.fontawesome.com/releases/v5.0.8/js/all.js"></script>
<!-- fontawesome -->
<!-- CSS -->
<link rel="stylesheet" href="../CSS/personale.css"/>
<link rel="stylesheet" href="../CSS/jquery-ui.min.css"/>
<link rel="stylesheet" href="../CSS/jquery-ui.structure.min.css">
<link rel="stylesheet" href="../CSS/jquery-ui.theme.min.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=EB+Garamond" rel="stylesheet">

</head>

这是列表(带有 bootstrap 4)

<div class="row" id="contenutoDaOrdinare">
<ul class="list-group" id="sortable">
<li class="list-group-item">Cras justo odio</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Morbi leo risus</li>
<li class="list-group-item">Porta ac consectetur ac</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>
</div>

在主体的末尾:

<script type="text/javascript">
$( function() {
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();
} );

</script>
<!-- Libreria Jquery Bootstrap -->

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="../JS/getusers.js"></script>
<script src="../JS/jquery-ui.js"></script>
</body>

这是我根目录中的结构: enter image description here

我想使 html 中的列表可排序。你能帮助我吗?非常感谢!

最佳答案

您需要在加载 jQuery 库后移动该内联脚本,因为它依赖于 jQuery UI。

    <!-- Libreria Jquery Bootstrap -->

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="../JS/getusers.js"></script>
<script src="../JS/jquery-ui.js"></script>

<script type="text/javascript">
$( function() {
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();
} );

</script>

关于javascript - jQueryUI 不在页面中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49596673/

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