你好,是这样吗?
我试了还是无效。
[HTML] 纯文本查看 复制代码 <head>
<meta charset="utf-8">
<title>无标题文档</title>
<link href="css/jquery-ui.min.css" rel="stylesheet">
<script src="js/jquery.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/sweetalert2.js"></script>
</head>
<body>
<h3 style="color: red">问题:jQuery Autocomplete在sweetalert2对话框中无法弹出自动填写列表。</h3>
<h2>仅autocomplete:</h2>
<input class="inpSearch" placeholder="autocomplete input">
</br>
</br>
<h2>sweetalert2+autocomplete:</h2>
<button>srart</button>
<script>
$(function() {
var availableTags = ["ActionScript","AppleScript","Asp","BASIC","C","C++","Clojure","COBOL","ColdFusion","Erlang","Fortran","Groovy","Haskell","Java","JavaScript","Lisp","Perl","PHP","Python","Ruby","Scala","Scheme"];
$( ".inpSearch" ).autocomplete({
source: availableTags
});
});
$("button").click(function() {
Swal.fire({
title: 'Multiple inputs',
html:'<input class="swal2-input inpSearch" placeholder="autocomplete input"><input class="swal2-input">',
})
$(".inpSearch" ).autocomplete({
source: availableTags
});
} )
</script>
</body> |