본문 바로가기
Developer/Javascript & jQuery

[jquery] 선택박스 대신 selectable

by 순수한소년 2017. 1. 30.
728x90
반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>jQuery UI</title>
<!--<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/redmond/jquery-ui.min.css" /> -->
<!--<link rel="stylesheet" href="select.css" /> -->
<body>
    <ul id="list">
        <li id="1">1. 영어회화</li>
        <li id="2">2. 악기</li>
        <li id="3">3. 수영</li>
        <li id="4">4. 서예</li>
        <li id="5">5. 주판</li>
        <li id="6">6. 축구</li>
        <li id="7">7. 컴퓨터</li>
        <li id="8">8. 태권도</li>
    </ul>
    <div id="result">
        <div>
<!--            <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> -->
<!--            <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script> -->
            <script>
                $(function() {
                    $('#list').selectable({
                        stop : function() {
                            $('#result').text($('.ui-selected').text() + '을 선택했습니다.');
                        }
                    });
                });
            </script>
</body>
</html>
cs


jQuery UI
  • 1. 영어회화
  • 2. 악기
  • 3. 수영
  • 4. 서예
  • 5. 주판
  • 6. 축구
  • 7. 컴퓨터
  • 8. 태권도


728x90
반응형