70 lines
2.5 KiB
HTML
70 lines
2.5 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Bootstrap AutoComplete Test Issue 80</title>
|
|
|
|
<!-- Required meta tags -->
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1 class="border-bottom">Bootstrap Autocomplete test issue 80</h1>
|
|
<p>
|
|
Testing page for <a href="https://github.com/xcash/bootstrap-autocomplete/issues/80">issue #80</a>
|
|
</p>
|
|
<form action="//httpbin.org/anything" method="GET" target="_blank">
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<input class="form-control basicAutoComplete" name="q" type="text" autocomplete="off">
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<script src="http://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
|
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
|
|
<script src="../bootstrap-autocomplete.js"></script>
|
|
<script>
|
|
$(function () {
|
|
var cbNR = $('#returnNoResults');
|
|
|
|
var results = [];
|
|
for (var i=111; i<99999; i++) {
|
|
results.push(i.toString());
|
|
}
|
|
|
|
$('.basicAutoComplete').autoComplete({
|
|
resolver: 'custom',
|
|
// noResultsText: '',
|
|
events: {
|
|
search: function (qry, callback) {
|
|
var res = results.filter( (v) => {
|
|
if (v.indexOf(qry) > -1) {
|
|
return v;
|
|
}
|
|
})
|
|
callback(res);
|
|
}
|
|
}
|
|
});
|
|
|
|
// Events
|
|
$('.basicAutoComplete').on('change', function() {
|
|
console.log('basicAutoComplete change');
|
|
});
|
|
$('.basicAutoComplete').on('autocomplete.select', function(evt, item) {
|
|
console.log('basicAutoComplete autocomplete.select');
|
|
});
|
|
$('.basicAutoComplete').on('autocomplete.freevalue', function(evt, item) {
|
|
console.log('basicAutoComplete autocomplete.freevalue');
|
|
});
|
|
|
|
$('.basicAutoComplete').focus();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |