본문 바로가기
프로그래머/프로그래밍

jQuery autocomplete.js 개발자 맘대로 환경 바꾸기

by plog 2010. 2. 6.
첫번째 아이템이 기본적으로 선택이 되어버리는 바람에
그걸 선택하고 싶지 않음에도 불구하고 엔터키를 눌러버리면 첫번째 항목이 input박스에 나타났다 ... 짱나게 시리

아래의 파일에서 환경을 변경하면 그런현상을 막을 수 있다.

jquery.autocomplete.js 파일에서
$.Autocompleter.defaults = { 
     inputClass: "ac_input",
     resultsClass: "ac_results",
     loadingClass: "ac_loading",
     minChars: 1,
     delay: 400,
     matchCase: false,
     matchSubset: true,
     matchContains: false,
     cacheLength: 10,
     max: 100,
    mustMatch: false,
    extraParams: {},
    selectFirst: false, << true 로 하면 자동으로 첫번째 항목이 input box 에 들어간다.
    formatItem: function(row) { return row[0]; },
    formatMatch: null,
    autoFill: false,
    width: 0,
    multiple: false,
    multipleSeparator: ", ",

이 함수에 있는 모든 옵션을 수정하여 입맛에 맞는 autocomplete 를 즐길 수 있을 것이라 생각된다

댓글