Live Brilliant

[jquery] select2 width 본문

개발은 핵찜이야/JQUERY

[jquery] select2 width

주인정 2014. 7. 30. 11:02


select 2는 jquery 기반으로 select box 를 대신하여 사용합니다.

검색 지원, 원격 데이터 세트, 결과 무한 스크롤


사용법은 아래 사이트에서 예제를 보며 습득


http://ivaynberg.github.io/select2/

[기본 예제 코드]


<head>

    <link href="select2.css" rel="stylesheet"/>

    <script src="select2.js"></script>

    <script>

        $(document).ready(function() { $("#e1").select2(); });

    </script>

</head>

<body>

    <select id="e1">

        <option value="AL">Alabama</option>

        ...

        <option value="WY">Wyoming</option>

    </select>

</body>

# select box 넓이를 실제 불러온 데이터 넓이에 맞게 표현하고싶을때 

{width: 'resolve'}

$(document).ready(function() { 
    $("#myselect").select2({ width: 'resolve' });           
});


Comments