PageSourceSearch

https://99mall.kr/data/skin/front/moment_left/js/gd_multi_select_box.js

js 99mall.kr collected 2026-10-06 03:43:20 UTC 2,732 bytes, 86 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				
52				try {            
53                	data = JSON.parse(data);            
54                } catch (e) {            
55                    $(targetID).html('<option value="">' + emptyText + '</option>');            
56                    $(targetID).trigger('chosen:updated');            
57                    return;            
58                }            
59                    									  
60				if (data !='' && data != null && $(targetID).length != 0) {
61					$(targetID).html('');
62					var k = 1;
63					for (var j = 0; j < data.length; j++)
64					{
65						if(j == 0)
66						{
67							$(targetID).get(0).add(new Option(emptyText,''), document.all ? j : null);
68						}
69						k	= k + j
70						$(targetID).get(0).add(new Option(data[j]['optionText'],data[j]['optionValue']), document.all ? k : null);
71						if(data[j]['disabledStr']) {
72                            $(targetID+" option:eq("+(j+1)+")").attr("disabled", "disabled");
73						}
74
75						$(targetID).trigger('chosen:updated');
76					}
77				}
78			}
79
80			$.post( url, parameters, postCallback );
81		});
82
83	});
84
85}
86})(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.