JavaScriptプログラムに関する各種メモ書き

Googleサジェストライクなプラグイン

入力テキストの値を補間するGoogleサジェストライクなプラグイン

● Bootstrap combbox

http://jsdo.it/mottsu/qqoq

デモ
http://logic.moo.jp/livedemo/bootstrap_combo_box/test.html

● jquery.ajax-combobox

https://github.com/sutara79/jquery.ajax-combobox/

・デモ

http://logic.moo.jp/livedemo/jquery_combo_box/mydemo.html

$(function() {
  $('#foo').ajaxComboBox(
    'mydemo.json',
    {
      db_table: 'name',
      per_page: 20,
      navi_num: 10
    }
  );
});

mydemo.json の中身はこんな感じにします

{
  "result":[
    {"name":"りんご"},
    {"name":"オレンジ"},
    {"name":"みかん"},
    {"name":"メロン"},
    {"name":"グレープフルーツ"},
    {"name":"すいか"},
    {"name":"もも"},
    {"name":"洋梨"},
    {"name":"いちご"},
    {"name":"マンゴー"}
  ] ,
  "cnt_whole":"10"
}

● typeahead.js

https://github.com/twitter/typeahead.js/

● jquery.autocomplete.js

http://docs.jquery.com/Plugins/Autocomplete

サンプルコード

$(function() {
	$("#Keywords").autocomplete('/ajax_suggest.php?flag=amazon', {
		delay : 50
	}).keydown(function(event){
        if( event.keyCode == 13 ){
            if( !event.isDefaultPrevented() ){
                return false;
            }
			else{
				document.form1.submit();;
			}
        }
    });
});

関連エントリー

No.794
11/18 15:49

edit

jQuery
Ajax