gpt4 book ai didi

javascript - 如何在我的 Web 应用程序中添加第三方组件?

转载 作者:太空宇宙 更新时间:2023-11-04 01:51:19 24 4
gpt4 key购买 nike

我想出的是,首先我必须在 header 中提及 css 文件的链接,然后我必须提及 js 文件的链接在标签之前。但是我未能使用这种方法使用 semantic-ui.com 中的组件。我想要这样的东西。 enter image description here

semantic-ui.com中叫做“多重搜索选择”。我所做的是:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.10/semantic.min.css">

</head>
<body>

<select class="ui fluid search dropdown" multiple="">
<option value="">State</option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>

</select>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.10/semantic.min.js"></script>
</body>
</html>

我在控制台中没有收到任何错误。

最佳答案

查看控制台,您可以看到以下错误:

Uncaught ReferenceError: jQuery is not defined
at semantic.min.js:11

您还需要添加 jQuery .

编辑:此外,您需要像这样使用 .dropdown() 命令对其进行初始化

$('select').dropdown();

这里的工作示例:Fiddle

关于javascript - 如何在我的 Web 应用程序中添加第三方组件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43438832/

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