PageSourceSearch

https://ssupl.com/data/skin/front/19-07_C/js/gd_multi_select_box.js

js ssupl.com collected 2026-10-09 23:37:44 UTC 2,329 bytes, 78 lines download raw bytes

1/**
2 * Multi Select Box - jQuery plugin
3 *
4 * @author artherot
5 * @version 1.0
6 * @since 1.0
7 * @copyright Copyright (c), Godosoft
8 */
9
10/**
11 * 생성한 Select Box 에 순차적으로 option 값을 넣는 것임
12 * JSON을 이용하여, option 선택시 다음 select box에 값이 있는지를 ajax post를 이용해서 불러옴
13 * @param String Select box default ID
14 * @param integer Select box 갯수
15 * @param String post 로 넘길 URL
16 * @param String Select box 의 첫번째 option index name
17 * <code>
18 * JSON 예제 : [{"optionValue":"001","optionText":"test"},{"optionValue":"002","optionText":"sample"}]
19 * <script type="text/javascript">
20 * $(function() {
21 *     $('#testSample1').multi_select_box('#testSample',2,'test.php','선택하세요');
22 *     $('#testSample2').multi_select_box('#testSample',2,'test.php','선택하세요');
23 * });
24 * </script>
25 * </code>
26 */
27(function($){
28$.fn.multi_select_box = function(selectID, cnt, url, emptyText) {
29
30	return this.each(function(index, domEle) {
31
32		$(this).change( function(event)
33		{
34			var thisID		= event.currentTarget.id;
35			var selectPanel	= parseInt(thisID.substr((selectID.length - 1),1)) + 1;
36			var targetID	= selectID + selectPanel;
37			var parameters	= { mode:'next_select', value:$(this).val() };
38			var tmpID		= '';
39
40			postCallback	= function(data)
41			{
42				if (emptyText !='' && emptyText != null)
43				{
44					for (var i = selectPanel; i <= cnt; i++)
45					{
46						tmpID	= selectID + i;
47						$(tmpID).html('<option value="">'+emptyText+'</option>');
48						$(tmpID).trigger('chosen:updated');
49					}
50				}
51				data = eval(data);
52				if (data !='' && data != null) {
53					$(targetID).html('');
54					var k = 1;
55					for (var j = 0; j < data.length; j++)
56					{
57						if(j == 0)
58						{
59							$(targetID).get(0).add(new Option(emptyText,''), document.all ? j : null);
60						}
61						k	= k + j
62						$(targetID).get(0).add(new Option(data[j]['optionText'],data[j]['optionValue']), document.all ? k : null);
63						if(data[j]['disabledStr']) {
64                            $(targetID+" option:eq("+(j+1)+")").attr("disabled", "disabled");
65						}
66
67						$(targetID).trigger('chosen:updated');
68					}
69				}
70			}
71
72			$.post( url, parameters, postCallback );
73		});
74
75	});
76
77}
78})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.