Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
71 lines (64 sloc) 2.71 KB
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/ui-lightness/jquery-ui.css">
<style>
.ui-autocomplete {
max-height: 100px;
overflow-y: auto;
/* prevent horizontal scrollbar */
overflow-x: hidden;
/* add padding to account for vertical scrollbar */
padding-right: 20px;
}
/* IE 6 doesn't support max-height
* we use height instead, but this forces the menu to always be this tall
*/
* html .ui-autocomplete {
height: 100px;
}
</style>
</head>
<body>
<h1>jQuery UI Autocomplete sample 3(スクロール付き、カスタムデータ)</h1>
<div class="sample">
<div class="ui-widget">
<label for="bank_search">銀行検索(銀行コードor銀行名): </label>
<input type="text" id="bank_search" style="width:350px">
<br><br>
<form method="GET">
<label for="bank_code">銀行コード: </label>
<input type="text" id="bank_code" style="width:300px" readonly="readonly" name="code">
<br><br>
<label for="bank_name">銀行名: </label>
<input type="text" id="bank_name" style="width:300px" readonly="readonly" name="name">
<br><br>
<input type="submit">
</form>
</div>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function() {
var banks = [
{value: "0001:みずほ銀行", code:"0001", name:"みずほ銀行"},
{value: "0005:三菱東京UFJ銀行", code:"0005", name:"三菱東京UFJ銀行"},
{value: "0009:三井住友銀行", code:"0009", name:"三井住友銀行"},
{value: "0016:みずほコーポレート銀行", code:"0016", name:"みずほコーポレート銀行"},
{value: "0033:ジャパンネット銀行", code:"0033", name:"ジャパンネット銀行"},
{value: "0034:セブン銀行", code:"0034", name:"セブン銀行"},
{value: "0035:ソニー銀行", code:"0035", name:"ソニー銀行"},
{value: "9900:ゆうちょ銀行", code:"9900", name:"ゆうちょ銀行"}];
var opts = {source: banks,
select: function(event, ui){
$('#bank_code').val(ui.item.code);
$('#bank_name').val(ui.item.name);
return false;
}};
$("#bank_search").autocomplete(opts).autocomplete('option', 'minLength', 0);
});
</script>
</body>
</html>