知識點:在使用模態框中使用 jquery-ui autocomplete,無法顯示下拉框的數據
參考博客:https://www.jianshu.com/p/3944693773ed
解決辦法:在autocomplete中添加 appendTo
<body>
<html>
<div class="modal-body"
>
<form class="m-form m-form--fit m-form--label-align-right" id="m-form-1">
<label class="col-form-label col-lg-2 col-sm-12">
葯品名稱 <span style="color: #F00">*</span>
</label>
<input type="text" style="width: 120px; z-index: 1055;" onchange="test1(this)"
class="form-control m-input" placeholder="葯品名稱" id="rolename" autocomplete="off" >
</form>
</div>
<script>
function test1(){
debugger
var arr=["zhansan","lishi"];
$("#rolename").autocomplete({
source : arr,// 數據
appendTo:$("#m-form-1") //m-form-1是from表單的id
});
}
</script>
</body>
</html>