{"id":1185,"date":"2013-07-16T19:30:44","date_gmt":"2013-07-16T19:30:44","guid":{"rendered":"http:\/\/www.phpmind.com\/blog\/?p=1185"},"modified":"2013-07-16T19:47:51","modified_gmt":"2013-07-16T19:47:51","slug":"how-to-pass-dropdown-value-to-text-box","status":"publish","type":"post","link":"https:\/\/www.phpmind.com\/blog\/2013\/07\/how-to-pass-dropdown-value-to-text-box\/","title":{"rendered":"How to pass dropdown value to text box ?"},"content":{"rendered":"<p>I had a situation where requirement was to pass select box value to another text field. Using jQuery it is very easy.<\/p>\n<p>See the code below. <\/p>\n<pre lang=\"js\">\r\n<input id=\"operational_name\"  type=\"text\" value=\"\" name=\"operational_name\">\r\n\r\n<select id=\"account_name\" name=\"account_name2\">\r\n    <option value=\"1\">YAHOO<\/option>\r\n    <option value=\"2\">PANASONIC<\/option>\r\n    <option value=\"3\">Google<\/option>\r\n<\/select>\r\n\r\n\r\n<script type=\"text\/javascript\">\r\n    $(document).ready(function(){\r\n        $(\"#account_name\").live(\"change\", function() {\r\n            $(\"#operational_name\").val($(this).find(\"option:selected\").attr(\"value\"));\r\n            \r\n        });\r\n    });\r\n<\/script>\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I had a situation where requirement was to pass select box value to another text field. Using jQuery it is very easy. See the code below. YAHOO PANASONIC Google<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[27,30],"tags":[],"class_list":["post-1185","post","type-post","status-publish","format-standard","hentry","category-javascript","category-jquery"],"_links":{"self":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/comments?post=1185"}],"version-history":[{"count":2,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1185\/revisions"}],"predecessor-version":[{"id":1187,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1185\/revisions\/1187"}],"wp:attachment":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/media?parent=1185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/categories?post=1185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/tags?post=1185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}