{"id":8178,"date":"2022-08-30T14:57:24","date_gmt":"2022-08-30T14:57:24","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/11\/29\/how-do-i-reset-a-jquery-chosen-select-option-with-jquery-open-source-projects-harvesthq-chosen\/"},"modified":"2022-08-30T15:02:58","modified_gmt":"2022-08-30T15:02:58","slug":"how-do-i-reset-a-jquery-chosen-select-option-with-jquery-open-source-projects-harvesthq-chosen","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-do-i-reset-a-jquery-chosen-select-option-with-jquery-open-source-projects-harvesthq-chosen\/","title":{"rendered":"How do I reset a jquery-chosen select option with jQuery?-open source projects harvesthq\/chosen"},"content":{"rendered":"<p>I have tried numerous things and nothing seems to be working.<\/p>\n<p>I am using jQuery and Chosen plugin.<\/p>\n<p>Methods I have tried:<\/p>\n<pre><code>var select = jQuery('#autoship_option');\n\nselect.val(jQuery('options:first', select).val());\n\njQuery('#autoship_option').val('');\n\njQuery('#autoship_option').text('');\n\njQuery('#autoship_option').empty('');\n\njQuery(\"#autoship_option option[value='']\").attr('selected', true);\n<\/code><\/pre>\n<p>It always shows the Active Autoship option once it has been selected. I can&#8217;t seem to get it to clear the selection.<\/p>\n<p>Here is the select box:<\/p>\n<pre><code>\n    \n    Active Autoship\n\n<\/code><\/pre>\n<p>Anyone familiar with Chosen and being able to clear a select box with one option? (It will have more options in the future.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have tried numerous things and nothing seems to be working. I am using jQuery and Chosen plugin. Methods I have tried: var select = jQuery(&#8216;#autoship_option&#8217;); select.val(jQuery(&#8216;options:first&#8217;, select).val()); jQuery(&#8216;#autoship_option&#8217;).val(&#8221;); jQuery(&#8216;#autoship_option&#8217;).text(&#8221;); jQuery(&#8216;#autoship_option&#8217;).empty(&#8221;); jQuery(&#8220;#autoship_option option[value=&#8221;]&#8221;).attr(&#8216;selected&#8217;, true); It always shows the Active Autoship option once it has been selected. I can&#8217;t seem to get it to clear the [&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-8178","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8178","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=8178"}],"version-history":[{"count":1,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8178\/revisions"}],"predecessor-version":[{"id":8505,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8178\/revisions\/8505"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=8178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=8178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=8178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}