gpt4 book ai didi

jQuery Ui 甚至不创建 ui 元素

转载 作者:行者123 更新时间:2023-12-01 04:34:17 24 4
gpt4 key购买 nike

这是我第一次使用 jQuery ui。我遵循了这个文档https://jqueryui.com/autocomplete/但这对我不起作用。当我在 codepen 中运行相同的代码时,它正在工作。

自动完成功能正在执行,没有任何错误,但它只是不创建建议列表(ul 元素)

HTML:

<head>
<link rel="stylesheet" href="{{asset('assets/css/bootstrap.min.css')}}"> {{--jQuery UI For Autocomplete--}}
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">

<script src="{{asset('assets/js/jquery-3.4.1.min.js')}}"></script>
<script src="{{asset('assets/js/bootstrap.bundle.js')}}"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>

<div class="col ui-widget">
<label for="create-affinity-id" class="font-weight-bold">Affinity Id</label>
<input id="create-affinity-id" type="text" class="form-control" name="affinity_id" placeholder="Affinity ID">
</div>

脚本

<script>
$(document).ready(function() {
var availableTutorials = [
"ActionScript",
"Bootstrap",
"C",
"C++",
];

$('#create-affinity-id').autocomplete({
source: availableTutorials
});
}
});
</script>

最佳答案

两个语法错误额外的和额外的{用这个替换js代码

$(document).ready(function(){
var availableTutorials = [
"ActionScript",
"Bootstrap",
"C",
"C++"
];
$('#create-affinity-id').autocomplete({
source: availableTutorials
});

});

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<head>
<link rel="stylesheet" href="{{asset('assets/css/bootstrap.min.css')}}">
{{--jQuery UI For Autocomplete--}}
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">

<script src="{{asset('assets/js/jquery-3.4.1.min.js')}}"></script>
<script src="{{asset('assets/js/bootstrap.bundle.js')}}"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>

<div class="col ui-widget">
<label for="create-affinity-id" class="font-weight-bold">Affinity Id</label>
<input id="create-affinity-id" type="text" class="form-control" name="affinity_id" placeholder="Affinity ID">
</div>

<script>

$(document).ready(function(){
var availableTutorials = [
"ActionScript",
"Bootstrap",
"C",
"C++"
];

$('#create-affinity-id').autocomplete({
source: availableTutorials
});

});

</script>

关于jQuery Ui 甚至不创建 ui 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59834390/

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