{"id":7890,"date":"2015-11-05T13:42:39","date_gmt":"2015-11-05T13:42:39","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/11\/05\/chosen-select-an-option-by-default-with-jquery-open-source-projects-harvesthq-chosen\/"},"modified":"2015-11-05T13:42:39","modified_gmt":"2015-11-05T13:42:39","slug":"chosen-select-an-option-by-default-with-jquery-open-source-projects-harvesthq-chosen","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2015\/11\/05\/chosen-select-an-option-by-default-with-jquery-open-source-projects-harvesthq-chosen\/","title":{"rendered":"Chosen select an option by default with jQuery-open source projects harvesthq\/chosen"},"content":{"rendered":"<p>I have one select box with options and I am using jQuery &#8220;Chosen&#8221; on a Zend View. This plugin is working fine.<\/p>\n<pre><code>Javascript:\n$('#select_type').chosen();\n<\/code><\/pre>\n<p>My problem is I need to select one of the options when the page loads depending on what the value of type_id is. I tried this:<\/p>\n<pre><code>document.getElementById('select_type').value = '';\n<\/code><\/pre>\n<p>This changes its value but the option is not selected in the JQuery chosen.<\/p>\n<p>Any ideas?<\/p>\n<p>EDIT: The option successfully changes by doing what I have mentioned above but it does not update\/change the selected element in jQuery &#8220;chosen&#8221; plugin. My question is about updating the selected value for jQuery Chosen not the HTML SELECT (which I have done successfully). Here is a link to jQuery Chosen plugin<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have one select box with options and I am using jQuery &#8220;Chosen&#8221; on a Zend View. This plugin is working fine. Javascript: $(&#8216;#select_type&#8217;).chosen(); My problem is I need to select one of the options when the page loads depending on what the value of type_id is. I tried this: document.getElementById(&#8216;select_type&#8217;).value = &#8221;; This changes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7890","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7890","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7890"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7890\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}