{"id":11747,"date":"2016-04-04T16:15:11","date_gmt":"2016-04-04T13:15:11","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=11747"},"modified":"2017-12-21T15:26:10","modified_gmt":"2017-12-21T13:26:10","slug":"jquery-select-option-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/","title":{"rendered":"jQuery Select Option Example"},"content":{"rendered":"<p>The aim of this example is to explain and use various jQuery selectors and methods related to manipulation the select dropdown element of HTML. The <code>&lt;select&gt;<\/code> element is used to create a drop-down list. The <code>&lt;option&gt;<\/code> tags inside the element define the available options in the list. These basic HTML elements are the ones we&#8217;ll apply special selector and\/or methods to make them fit our every need.<\/p>\n<p>So, why do we need to manipulate the select dropdown? Well, in many cases, the information stored in this element needs to be dynamic, meaning depended on some other action taken beforehand. Also, in other cases, the user may have interacted with the dropdown and we need to reset it when a new user accesses the page.<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;qGGDqWnle19VavkM&#8217;]<\/p>\n<h2>1. Document Setup<\/h2>\n<p>To begin, create a new HTML document and add the basic syntax inside, including the jQuery library link:<\/p>\n<pre class=\"brush:xml\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;jQuery Select Option Example&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;!-- HTML SECTION  --&gt;\r\n\r\n\r\n&lt;!-- JAVASCRIPT SECTION  --&gt;\r\n&lt;script src=\"jquery-1.11.3.min.js\"&gt;&lt;\/script&gt;\r\n\r\n&lt;script type=\"text\/javascript\"&gt;\r\n\r\n&lt;\/script&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>Just to illustrate the idea of having a select dropdown in our page, this is an example:<\/p>\n<pre class=\"brush:xml\">&lt;!-- HTML SECTION  --&gt;\r\n&lt;select&gt;\r\n    &lt;option&gt;Option 1&lt;\/option&gt;\r\n    &lt;option&gt;Option 2&lt;\/option&gt;\r\n    &lt;option&gt;Option 3&lt;\/option&gt;\r\n&lt;\/select&gt;\r\n<\/pre>\n<p>Well, this is the most basic example, because normally the <code>select<\/code> and <code>option<\/code> also have their respective attributes applied to make them more dynamic and accessible. For now, it would have this simple view in the browser:<\/p>\n<figure id=\"attachment_11753\" aria-describedby=\"caption-attachment-11753\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-1.jpg\" rel=\"attachment wp-att-11753\"><img decoding=\"async\" class=\"size-full wp-image-11753\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-1.jpg\" alt=\"The select element of HTML\" width=\"820\" height=\"136\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-1.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-1-300x50.jpg 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-1-768x127.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-11753\" class=\"wp-caption-text\">The select element of HTML<\/figcaption><\/figure>\n<h2>2. Cases and Examples<\/h2>\n<p>In the following section, we&#8217;re having a look at the various cases we can use jQuery with the <code>select<\/code> element.<\/p>\n<h3>2.1 Get selected text from the select box<\/h3>\n<p>In this example, we&#8217;ll get the text of the selected option:<\/p>\n<pre class=\"brush:xml\">&lt;select id=\"box\"&gt;\r\n    &lt;option&gt;First Text&lt;\/option&gt;\r\n    &lt;option&gt;Second Text&lt;\/option&gt;\r\n    &lt;option selected=\"selected\"&gt;Third Text&lt;\/option&gt;\r\n&lt;\/select&gt;\r\n\r\n&lt;p&gt;&lt;\/p&gt;\r\n<\/pre>\n<p>As you can see, we added a new <code>id<\/code> and a <code>selected<\/code> attribute and also an empty paragraph where we&#8217;ll store the text we got from the select box:<\/p>\n<pre class=\"brush:js\">&lt;script type=\"text\/javascript\"&gt;\r\n    var boxText = $(\"#box option:selected\").text(); \/\/ get the text\r\n    $('p').text(boxText);   \/\/ place the boxText in a paragraph\r\n&lt;\/script&gt;\r\n<\/pre>\n<p>In this case the result would be &#8220;Third Text&#8221; because that is the option currently pre selected:<\/p>\n<figure id=\"attachment_11758\" aria-describedby=\"caption-attachment-11758\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-2.jpg\" rel=\"attachment wp-att-11758\"><img decoding=\"async\" class=\"size-full wp-image-11758\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-2.jpg\" alt=\"Getting the text from the select box!\" width=\"820\" height=\"136\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-2.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-2-300x50.jpg 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-2-768x127.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-11758\" class=\"wp-caption-text\">Getting the text from the select box!<\/figcaption><\/figure>\n<h3>2.2 Select option using the value attribute<\/h3>\n<p>In this example we&#8217;ll get the text of a specific value on an option:<\/p>\n<pre class=\"brush:xml\">&lt;select name=\"box\"&gt;\r\n    &lt;option value=\"1\"&gt;First Text&lt;\/option&gt;\r\n    &lt;option value=\"2\"&gt;Second Text&lt;\/option&gt;\r\n    &lt;option value=\"3\"&gt;Third Text&lt;\/option&gt;\r\n&lt;\/select&gt;\r\n<\/pre>\n<p>In this case, we used the <code>name<\/code> attribute inside the select <code>element<\/code>. Additionally, <code>option<\/code>s now have a unique <code>value<\/code> identifier. In jQuery, we&#8217;ll be selecting using the name attribute and applying the <code>.val()<\/code> method we&#8217;ll choose to display only the option we want as the default selected in the select box:<\/p>\n<pre class=\"brush:js\">&lt;script type=\"text\/javascript\"&gt;\r\n    $('[name=box]').val( 2 ); \/\/ this will select the second text\r\n&lt;\/script&gt;\r\n<\/pre>\n<p>As expected, the view in the browser would be:<\/p>\n<figure id=\"attachment_11761\" aria-describedby=\"caption-attachment-11761\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-3.jpg\" rel=\"attachment wp-att-11761\"><img decoding=\"async\" class=\"size-full wp-image-11761\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-3.jpg\" alt=\"Selecting an option by its value\" width=\"820\" height=\"136\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-3.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-3-300x50.jpg 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-3-768x127.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-11761\" class=\"wp-caption-text\">Selecting an option by its value<\/figcaption><\/figure>\n<h3>2.3 Select option using the option text<\/h3>\n<p>In this third example, we&#8217;ll be selecting and displaying an option in a rather professional way.<\/p>\n<pre class=\"brush:js\">&lt;script type=\"text\/javascript\"&gt;\r\n    $('[name=box] option').filter(function() {  \/\/ applied the filter method\r\n        return ($(this).text() == 'Third Text');  \/\/ select 'Third Text'\r\n    }).prop('selected', true);  \/\/ change selected property to true\r\n&lt;\/script&gt;\r\n<\/pre>\n<p>So, after selecting the right <code>select<\/code> element, we apply the <code>filter<\/code> method (seems like we need to filter options) and give it a function as a parameter, which then leads to (returns) this element we&#8217;re selecting the text of which is equal to &#8216;Third Text&#8217;. But that just returns it, we don&#8217;t see anything. To display what is returned we add the <code>.prop()<\/code> method to all of this and define the <code>selected<\/code> attribute to <code>true<\/code>. In this case, the third option will be selected like so:<\/p>\n<figure id=\"attachment_11764\" aria-describedby=\"caption-attachment-11764\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-4.jpg\" rel=\"attachment wp-att-11764\"><img decoding=\"async\" class=\"size-full wp-image-11764\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-4.jpg\" alt=\"Select option using the option text\" width=\"820\" height=\"136\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-4.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-4-300x50.jpg 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-4-768x127.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-11764\" class=\"wp-caption-text\">Select option using the option text<\/figcaption><\/figure>\n<p>Setting the selected attribute to <code>true<\/code> is the same as setting it to <code>1<\/code> or <code>selected<\/code>.<\/p>\n<h2>3. Best jQuery Select Plugins<\/h2>\n<p>There are quite a lot of jQuery plugins out there to help you with a nice a smoothly animated select box\/dropdown that you may want to use. Below, we introduce some of the best plugins that you can use.<\/p>\n<h3>3.1 jQuery Nice Select<\/h3>\n<p>jQuery Nice Select is a lightweight jQuery plugin that replaces native select elements with customizable dropdowns.<\/p>\n<figure id=\"attachment_11767\" aria-describedby=\"caption-attachment-11767\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-5.jpg\" rel=\"attachment wp-att-11767\"><img decoding=\"async\" class=\"size-full wp-image-11767\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-5.jpg\" alt=\"jQuery Nice Select Plugin\" width=\"820\" height=\"284\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-5.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-5-300x104.jpg 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-5-768x266.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-11767\" class=\"wp-caption-text\">jQuery Nice Select Plugin<\/figcaption><\/figure>\n<ul>\n<li>You can find this plugin here: <a href=\"http:\/\/hernansartorio.com\/jquery-nice-select\/\" target=\"_blank\">Source + Demo<\/a><\/li>\n<\/ul>\n<h3>3.2 jQuery Selectbox plugin<\/h3>\n<p>Custom select box replacement inspired by jQuery UI source. Requires jQuery 1.4.x or higher.<\/p>\n<figure id=\"attachment_11769\" aria-describedby=\"caption-attachment-11769\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-6.jpg\" rel=\"attachment wp-att-11769\"><img decoding=\"async\" class=\"size-full wp-image-11769\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-6.jpg\" alt=\"jQuery Selectbox plugin\" width=\"820\" height=\"350\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-6.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-6-300x128.jpg 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-6-768x328.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-11769\" class=\"wp-caption-text\">jQuery Selectbox plugin<\/figcaption><\/figure>\n<p>You can find this plugin here: <a href=\"http:\/\/www.bulgaria-web-developers.com\/projects\/javascript\/selectbox\/\" target=\"_blank\">Source + Demo<\/a><\/p>\n<h3>3.3 jQuery Selectbox plugin<\/h3>\n<p>Good dropdown plugin, adds images and description to otherwise boring drop downs.<\/p>\n<figure id=\"attachment_11770\" aria-describedby=\"caption-attachment-11770\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-7.jpg\" rel=\"attachment wp-att-11770\"><img decoding=\"async\" class=\"size-full wp-image-11770\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-7.jpg\" alt=\"ddSlick jQuery Plugin\" width=\"820\" height=\"316\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-7.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-7-300x116.jpg 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/select-option-7-768x296.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-11770\" class=\"wp-caption-text\">ddSlick jQuery Plugin<\/figcaption><\/figure>\n<p>You can find this plugin here: <a href=\"http:\/\/designwithpc.com\/Plugins\/ddSlick\" target=\"_blank\">Source + Demo<\/a><\/p>\n<h2>4. Conclusion<\/h2>\n<p>To conclude, there are many ways we can use and play with the <code>select<\/code> dropdown element. Use jQuery to either manipulate behaviour or animate the dropdown box. While using jQuery to get or set values\/text for the options is important based on what you want to achieve, animation will always be an enhancement towards a better user experience, so just try to make it look as good as possible.<\/p>\n<h2>5. Download the Source Code<\/h2>\n<p>This was an example about jQuery Select Option.<\/p>\n<div class=\"download\"><strong>Download<\/strong> You can download the full source code of this example here: <strong><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/jQuery-Select-Option.zip\">jQuery Select Option<\/a><\/strong><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The aim of this example is to explain and use various jQuery selectors and methods related to manipulation the select dropdown element of HTML. The &lt;select&gt; element is used to create a drop-down list. The &lt;option&gt; tags inside the element define the available options in the list. These basic HTML elements are the ones we&#8217;ll &hellip;<\/p>\n","protected":false},"author":75,"featured_media":919,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[354,353],"class_list":["post-11747","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery","tag-option","tag-select"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>jQuery Select Option Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"The aim of this example is to explain and use various jQuery selectors and methods related to manipulation the select dropdown element of HTML. The\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"jQuery Select Option Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"The aim of this example is to explain and use various jQuery selectors and methods related to manipulation the select dropdown element of HTML. The\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/fabiocimo\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-04T13:15:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-21T13:26:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Fabio Cimo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fabiocimo\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fabio Cimo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/\"},\"author\":{\"name\":\"Fabio Cimo\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1dfb88b4a8d08c37a6080311fd330a22\"},\"headline\":\"jQuery Select Option Example\",\"datePublished\":\"2016-04-04T13:15:11+00:00\",\"dateModified\":\"2017-12-21T13:26:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/\"},\"wordCount\":789,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\",\"keywords\":[\"option\",\"select\"],\"articleSection\":[\"jQuery\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/\",\"name\":\"jQuery Select Option Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\",\"datePublished\":\"2016-04-04T13:15:11+00:00\",\"dateModified\":\"2017-12-21T13:26:10+00:00\",\"description\":\"The aim of this example is to explain and use various jQuery selectors and methods related to manipulation the select dropdown element of HTML. The\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"jQuery\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/jquery\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"jQuery Select Option Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1dfb88b4a8d08c37a6080311fd330a22\",\"name\":\"Fabio Cimo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b3df055f2e1b62e238889fafbb16121c68aab1adcd11af670e185cafae201b3b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b3df055f2e1b62e238889fafbb16121c68aab1adcd11af670e185cafae201b3b?s=96&d=mm&r=g\",\"caption\":\"Fabio Cimo\"},\"description\":\"Fabio is a passionate student in web tehnologies including front-end (HTML\/CSS) and web design. He likes exploring as much as possible about the world wide web and how it can be more productive for us all. Currently he studies Computer Engineering, at the same time he works as a freelancer on both web programming and graphic design.\",\"sameAs\":[\"https:\/\/www.facebook.com\/fabiocimo\",\"https:\/\/al.linkedin.com\/in\/fabiocimo\",\"https:\/\/x.com\/fabiocimo\",\"https:\/\/www.youtube.com\/fabiocimo1\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/fabio-cimo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"jQuery Select Option Example - Web Code Geeks - 2026","description":"The aim of this example is to explain and use various jQuery selectors and methods related to manipulation the select dropdown element of HTML. The","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/","og_locale":"en_US","og_type":"article","og_title":"jQuery Select Option Example - Web Code Geeks - 2026","og_description":"The aim of this example is to explain and use various jQuery selectors and methods related to manipulation the select dropdown element of HTML. The","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_author":"https:\/\/www.facebook.com\/fabiocimo","article_published_time":"2016-04-04T13:15:11+00:00","article_modified_time":"2017-12-21T13:26:10+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","type":"image\/jpeg"}],"author":"Fabio Cimo","twitter_card":"summary_large_image","twitter_creator":"@fabiocimo","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Fabio Cimo","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/"},"author":{"name":"Fabio Cimo","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1dfb88b4a8d08c37a6080311fd330a22"},"headline":"jQuery Select Option Example","datePublished":"2016-04-04T13:15:11+00:00","dateModified":"2017-12-21T13:26:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/"},"wordCount":789,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","keywords":["option","select"],"articleSection":["jQuery"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/","name":"jQuery Select Option Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","datePublished":"2016-04-04T13:15:11+00:00","dateModified":"2017-12-21T13:26:10+00:00","description":"The aim of this example is to explain and use various jQuery selectors and methods related to manipulation the select dropdown element of HTML. The","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-select-option-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"jQuery","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/jquery\/"},{"@type":"ListItem","position":4,"name":"jQuery Select Option Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1dfb88b4a8d08c37a6080311fd330a22","name":"Fabio Cimo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b3df055f2e1b62e238889fafbb16121c68aab1adcd11af670e185cafae201b3b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b3df055f2e1b62e238889fafbb16121c68aab1adcd11af670e185cafae201b3b?s=96&d=mm&r=g","caption":"Fabio Cimo"},"description":"Fabio is a passionate student in web tehnologies including front-end (HTML\/CSS) and web design. He likes exploring as much as possible about the world wide web and how it can be more productive for us all. Currently he studies Computer Engineering, at the same time he works as a freelancer on both web programming and graphic design.","sameAs":["https:\/\/www.facebook.com\/fabiocimo","https:\/\/al.linkedin.com\/in\/fabiocimo","https:\/\/x.com\/fabiocimo","https:\/\/www.youtube.com\/fabiocimo1"],"url":"https:\/\/www.webcodegeeks.com\/author\/fabio-cimo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/11747","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/75"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=11747"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/11747\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/919"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=11747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=11747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=11747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}