체크 박스 옵션이 많아져서 원하는 걸 찾기 어려울 때 사용하시면 됩니다.
몇 번 언급한 적이 있는 CoffeeScript를 사용했습니다.
[index.html]
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Checkbox Filter</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="http://jashkenas.github.com/coffee-script/extras/coffee-script.js" type="text/javascript"></script>
<script src="application.coffee" type="text/coffeescript"></script>
</head>
<body>
<div id="container">
<form method="post" action="/">
<label for="input-filter">Filter:</label>
<input id="input-filter" type="text" name="filter" />
<ul>
<li>
<input id="id_1" type="checkbox" name="ids[]" value="1" />
<label for="id_1">#1 - AA</label>
</li>
<li>
<input id="id_2" type="checkbox" name="ids[]" value="2" />
<label for="id_2">#2 - BA</label>
</li>
<li>
<input id="id_3" type="checkbox" name="ids[]" value="3" />
<label for="id_3">#3 - AB</label>
</li>
<li>
<input id="id_4" type="checkbox" name="ids[]" value="4" />
<label for="id_4">#4 - BB</label>
</li>
<li>
<input id="id_5" type="checkbox" name="ids[]" value="5" />
<label for="id_5">#5 - ABC</label>
</li>
</ul>
</form>
</div>
</body>
</html>
[stylesheet.css]
body {
font-size: 12px;
background: #FFF;
color: #333;
margin: 0;
}
#container {
margin: 10px auto;
width: 600px;
padding: 10px;
}
[application,coffee]
$ ->
$('form').submit ->
false
$('input[name=filter]').live 'keyup', ->
query = $(this).val().toLowerCase()
if $(query).is(':blank')
$('form li').show()
else
$('form li').each (i, item) ->
text = $(item).find('label').text().toLowerCase()
if text.search(query) < 0
$(item).hide()
else
$(item).show()
몇 번 언급한 적이 있는 CoffeeScript를 사용했습니다.
[index.html]
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Checkbox Filter</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="http://jashkenas.github.com/coffee-script/extras/coffee-script.js" type="text/javascript"></script>
<script src="application.coffee" type="text/coffeescript"></script>
</head>
<body>
<div id="container">
<form method="post" action="/">
<label for="input-filter">Filter:</label>
<input id="input-filter" type="text" name="filter" />
<ul>
<li>
<input id="id_1" type="checkbox" name="ids[]" value="1" />
<label for="id_1">#1 - AA</label>
</li>
<li>
<input id="id_2" type="checkbox" name="ids[]" value="2" />
<label for="id_2">#2 - BA</label>
</li>
<li>
<input id="id_3" type="checkbox" name="ids[]" value="3" />
<label for="id_3">#3 - AB</label>
</li>
<li>
<input id="id_4" type="checkbox" name="ids[]" value="4" />
<label for="id_4">#4 - BB</label>
</li>
<li>
<input id="id_5" type="checkbox" name="ids[]" value="5" />
<label for="id_5">#5 - ABC</label>
</li>
</ul>
</form>
</div>
</body>
</html>
[stylesheet.css]
body {
font-size: 12px;
background: #FFF;
color: #333;
margin: 0;
}
#container {
margin: 10px auto;
width: 600px;
padding: 10px;
}
[application,coffee]
$ ->
$('form').submit ->
false
$('input[name=filter]').live 'keyup', ->
query = $(this).val().toLowerCase()
if $(query).is(':blank')
$('form li').show()
else
$('form li').each (i, item) ->
text = $(item).find('label').text().toLowerCase()
if text.search(query) < 0
$(item).hide()
else
$(item).show()
댓글 2개
14년 전
[application,coffee] 여기서 , 는 . 이게 맞는거죠?
유용하게 쓰이겠네요 감사합니다.
유용하게 쓰이겠네요 감사합니다.
14년 전
헉, 마침표가 맞습니다!
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 3830 | 14년 전 | 933 | ||
| 3829 | 14년 전 | 1679 | ||
| 3828 | 14년 전 | 957 | ||
| 3827 |
방황하는중년
|
14년 전 | 907 | |
| 3826 |
|
14년 전 | 1638 | |
| 3825 | 14년 전 | 875 | ||
| 3824 | 14년 전 | 723 | ||
| 3823 | 14년 전 | 738 | ||
| 3822 |
level999
|
14년 전 | 832 | |
| 3821 | 14년 전 | 1016 | ||
| 3820 |
TzM위드컴
|
14년 전 | 935 | |
| 3819 | 14년 전 | 989 | ||
| 3818 |
base64
|
14년 전 | 1101 | |
| 3817 |
base64
|
14년 전 | 964 | |
| 3816 | 14년 전 | 2240 | ||
| 3815 | 14년 전 | 1866 | ||
| 3814 |
|
14년 전 | 2535 | |
| 3813 | 14년 전 | 504 | ||
| 3812 | 14년 전 | 808 | ||
| 3811 | 14년 전 | 1067 | ||
| 3810 | 14년 전 | 671 | ||
| 3809 |
스님꼬신수녀
|
14년 전 | 655 | |
| 3808 | 14년 전 | 1458 | ||
| 3807 | 14년 전 | 1271 | ||
| 3806 | 14년 전 | 2370 | ||
| 3805 | 14년 전 | 1264 | ||
| 3804 | 14년 전 | 850 | ||
| 3803 | 14년 전 | 3371 | ||
| 3802 | 14년 전 | 1592 | ||
| 3801 | 14년 전 | 1006 | ||
| 3800 | 14년 전 | 1358 | ||
| 3799 | 14년 전 | 717 | ||
| 3798 |
커피는막심
|
14년 전 | 1842 | |
| 3797 | 14년 전 | 775 | ||
| 3796 | 14년 전 | 1206 | ||
| 3795 | 14년 전 | 713 | ||
| 3794 |
방황하는중년
|
14년 전 | 1248 | |
| 3793 | 14년 전 | 1485 | ||
| 3792 | 14년 전 | 997 | ||
| 3791 | 14년 전 | 788 | ||
| 3790 | 14년 전 | 1008 | ||
| 3789 | 14년 전 | 934 | ||
| 3788 | 14년 전 | 1952 | ||
| 3787 | 14년 전 | 1117 | ||
| 3786 | 14년 전 | 814 | ||
| 3785 | 14년 전 | 710 | ||
| 3784 | 14년 전 | 1324 | ||
| 3783 | 14년 전 | 2618 | ||
| 3782 | 14년 전 | 706 | ||
| 3781 |
|
14년 전 | 2543 | |
| 3780 |
헬프데스크
|
14년 전 | 1664 | |
| 3779 |
방황하는중년
|
14년 전 | 899 | |
| 3778 |
|
14년 전 | 1103 | |
| 3777 |
|
14년 전 | 1014 | |
| 3776 |
스누피사랑
|
14년 전 | 994 | |
| 3775 |
silver31
|
14년 전 | 504 | |
| 3774 |
|
14년 전 | 716 | |
| 3773 | 14년 전 | 814 | ||
| 3772 |
|
14년 전 | 1175 | |
| 3771 | 14년 전 | 871 | ||
| 3770 | 14년 전 | 1228 | ||
| 3769 | 14년 전 | 1010 | ||
| 3768 |
Dokjin
|
14년 전 | 1111 | |
| 3767 |
Dokjin
|
14년 전 | 713 | |
| 3766 | 14년 전 | 1023 | ||
| 3765 |
|
14년 전 | 922 | |
| 3764 | 14년 전 | 804 | ||
| 3763 | 14년 전 | 692 | ||
| 3762 | 14년 전 | 1172 | ||
| 3761 |
쉽다zzz
|
14년 전 | 1582 | |
| 3760 |
gtm100
|
14년 전 | 938 | |
| 3759 |
원시인교주
|
14년 전 | 779 | |
| 3758 | 14년 전 | 3317 | ||
| 3757 | 14년 전 | 844 | ||
| 3756 | 14년 전 | 732 | ||
| 3755 | 14년 전 | 2132 | ||
| 3754 | 14년 전 | 1515 | ||
| 3753 | 14년 전 | 2027 | ||
| 3752 | 14년 전 | 595 | ||
| 3751 | 14년 전 | 856 | ||
| 3750 |
방황하는중년
|
14년 전 | 715 | |
| 3749 |
hopeone
|
14년 전 | 549 | |
| 3748 | 14년 전 | 636 | ||
| 3747 | 14년 전 | 757 | ||
| 3746 | 14년 전 | 1513 | ||
| 3745 | 14년 전 | 872 | ||
| 3744 | 14년 전 | 910 | ||
| 3743 | 14년 전 | 542 | ||
| 3742 | 14년 전 | 1076 | ||
| 3741 | 14년 전 | 1666 | ||
| 3740 |
매너천사12
|
14년 전 | 1049 | |
| 3739 |
SGFlash
|
14년 전 | 1396 | |
| 3738 |
C2HGroup
|
14년 전 | 915 | |
| 3737 | 14년 전 | 1048 | ||
| 3736 | 14년 전 | 805 | ||
| 3735 | 14년 전 | 1114 | ||
| 3734 | 14년 전 | 1006 | ||
| 3733 | 14년 전 | 418 | ||
| 3732 | 14년 전 | 560 | ||
| 3731 | 14년 전 | 641 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기