{"id":564,"date":"2012-02-09T06:21:51","date_gmt":"2012-02-09T06:21:51","guid":{"rendered":"http:\/\/brain.dailyon.net\/?p=564"},"modified":"2012-02-09T06:21:51","modified_gmt":"2012-02-09T06:21:51","slug":"jquery-select-box-example1","status":"publish","type":"post","link":"https:\/\/blog.goorigo.com\/?p=564","title":{"rendered":"jQuery : select box example1"},"content":{"rendered":"<p>\ub2e4\uc74c\uacfc \uac19\uc740 JSON \ud615\uc2dd\uc758 \ud30c\uc77c\uc774 \uc788\ub2e4\uace0 \uac00\uc815\ud55c\ub2e4.<\/p>\n<p><strong>Test.json<\/strong><\/p>\n<p>{&#8220;S1&#8221;:[<\/p>\n<p>{&#8220;S1_value&#8221;:&#8221;1&#8243;, &#8220;S1_text&#8221;: &#8220;\uac15\uc544\uc9c0&#8221;},<\/p>\n<p>{&#8220;S1_value&#8221;:&#8221;2&#8243;, &#8220;S1_text&#8221;: &#8220;\uace0\uc591\uc774&#8221;}<\/p>\n<p>],<\/p>\n<p>&#8220;S2&#8221;:[<\/p>\n<p>{&#8220;S2_value&#8221;:&#8221;1&#8243;, &#8220;S2_text&#8221;: &#8220;\uc218\ubc15&#8221;},<\/p>\n<p>{&#8220;S2_value&#8221;:&#8221;2&#8243;, &#8220;S2_text&#8221;: &#8220;\uc0ac\uacfc&#8221;}<\/p>\n<p>]<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Test.html<\/strong><\/p>\n<p>:<\/p>\n<p>:<\/p>\n<p>&lt;script src=&#8221;<a href=\"http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.5\/jquery.min.js\" target=\"_blank\">http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.5\/jquery.min.js<\/a>&#8221; type=&#8221;text\/javascript&#8221;&gt;&lt;\/script&gt;<\/p>\n<p>&lt;script language=javascript&gt;<\/p>\n<p>$(function(){<\/p>\n<p>var ani = &#8221;;<\/p>\n<p>var fru=&#8221;;<\/p>\n<p>$.getJSON(&#8220;Test.json&#8221; function(data){<\/p>\n<p>each(data.S1, function(i, ani_s){????????????<span style=\"color: #22741c\">\/\/JSON Data \uc911 S1(\uc560\uc644\ub3d9\ubb3c)\uc5d0 \ud574\ub2f9 \ub418\ub294\uac83\ub9cc \uac00\uc838\uc628\ub2e4.<\/span><\/p>\n<p>ani = ani + &#8220;&lt;option value='&#8221;+ani_s.S1_value+&#8221;&#8216;&gt;&#8221;+ani_s.S1_text+&#8221;&lt;\/option&gt;&#8221;;<\/p>\n<p>});<\/p>\n<p>&nbsp;<\/p>\n<p>each(data.S2, function(i, fru_s){????????????<span style=\"color: #22741c\">\/\/JSON Data \uc911 S2(\uacfc\uc77c)\uc5d0 \ud574\ub2f9 \ub418\ub294\uac83\ub9cc \uac00\uc838\uc628\ub2e4.<\/span><\/p>\n<p>fru = fru + &#8220;&lt;option value='&#8221;+fru_s.S2_value+&#8221;&#8216;&gt;&#8221;+fru_s.S2_text+&#8221;&lt;\/option&gt;&#8221;;<\/p>\n<p>});<\/p>\n<p>&nbsp;<\/p>\n<p>$(&#8220;#ANI&#8221;).empty().append(ani);????????????<span style=\"color: #22741c\">\/\/\uc560\uc644\ub3d9\ubb3c SelectBox? \ucd08\uae30\ud654 \ud6c4 append.<br \/>\n<\/span>$(&#8220;#FRU&#8221;).empty().append(fru);????????????<span style=\"color: #22741c\">\/\/\uacfc\uc77c SelectBox \ucd08\uae30\ud654 \ud6c4 append<\/span><\/p>\n<p>});<\/p>\n<p>});<\/p>\n<p>&lt;\/script&gt;<\/p>\n<p>:<\/p>\n<p><span style=\"color: #22741c\">\uc911\ub7b5<\/span><\/p>\n<p>:<\/p>\n<p>&lt;label for=&#8221;ANI&#8221;&gt;\uc560\uc644\ub3d9\ubb3c&lt;\/label&gt;&lt;select name=&#8221;ANI&#8221; ID=&#8221;ANI&#8221;&gt;&lt;\/select&gt;<\/p>\n<p>&lt;label for=&#8221;FRU&#8221;&gt;\uacfc\uc77c&lt;\/label&gt;&lt;select name=&#8221;FRUI&#8221; ID=&#8221;FRU&#8221;&gt;&lt;\/select&gt;<\/p>\n<p>:<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\uae30\ud0c0<\/strong><\/p>\n<p>SelectBox \uc560\uc644\ub3d9\ubb3c\uc911 \uace0\uc591\uc774 \uac12 \uc120\ud0dd\ud558\uae30.<\/p>\n<p>$(&#8220;#ANI&#8221;).val(&#8216;2&#8242;);<\/p>\n<p>$(&#8220;#ANI&gt;option[value=&#8217;2&#8242;]&#8221;).attr(&#8220;selected&#8221;, true);<\/p>\n<p>\ub610\ub294 \uc635\uc158\uadf8\ub8f9\uc774 \uc788\ub294Select Box?\uc778\uacbd\uc6b0<\/p>\n<p>$(&#8220;#ANI&gt; optgroup &gt;option[value=&#8217;2&#8217;]&#8221;).attr(&#8220;selected&#8221;, true);<\/p>\n<p>&nbsp;<\/p>\n<p>\uc120\ud0dd\ub41c \uac12 \uc77d\uc5b4\uc624\uae30<\/p>\n<p>$(&#8220;#ANI option:selected&#8221;).val();<br \/>\n$(&#8220;select[name=ANI]&#8221;).val();<\/p>\n<p>&nbsp;<\/p>\n<p>\uc120\ud0dd\ub41c \uac12 \uc0ad\uc81c<\/p>\n<p>$(&#8216;#ANI option:selected&#8217;).remove();<\/p>\n<p>&nbsp;<\/p>\n<p>SelectBox \uc560\uc644\ub3d9\ubb3c\uc911 \uace0\uc591\uc774?\uc0ad\uc81c<\/p>\n<p>$(&#8220;#ANI option[value=&#8217;2&#8242;]&#8221;).remove();<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\ucc38\uace0?<\/strong>: \uc720\uc6a9\ud55c Plug-in<\/p>\n<p><a href=\"http:\/\/www.techiegyan.com\/2008\/07\/26\/jquery-handling-html-select\/\" target=\"_blank\">http:\/\/www.techiegyan.com\/2008\/07\/26\/jquery-handling-html-select\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ub2e4\uc74c\uacfc \uac19\uc740 JSON \ud615\uc2dd\uc758 \ud30c\uc77c\uc774 \uc788\ub2e4\uace0 \uac00\uc815\ud55c\ub2e4. Test.json {&#8220;S1&#8221;:[ {&#8220;S1_value&#8221;:&#8221;1&#8243;, &#8220;S1_text&#8221;: &#8220;\uac15\uc544\uc9c0&#8221;}, {&#8220;S1_value&#8221;:&#8221;2&#8243;, &#8220;S1_text&#8221;: &#8220;\uace0\uc591\uc774&#8221;} ], &#8220;S2&#8221;:[ {&#8220;S2_value&#8221;:&#8221;1&#8243;, &#8220;S2_text&#8221;: &#8220;\uc218\ubc15&#8221;}, {&#8220;S2_value&#8221;:&#8221;2&#8243;, &#8220;S2_text&#8221;: &#8220;\uc0ac\uacfc&#8221;} ] } &nbsp; Test.html : : &lt;script&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/posts\/564"}],"collection":[{"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=564"}],"version-history":[{"count":0,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/posts\/564\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}