{"id":9371,"date":"2024-01-14T18:01:00","date_gmt":"2024-01-14T18:01:00","guid":{"rendered":"https:\/\/codehim.com\/?p=9371"},"modified":"2024-01-22T16:02:23","modified_gmt":"2024-01-22T11:02:23","slug":"javascript-custom-select-dropdown-with-description","status":"publish","type":"post","link":"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/","title":{"rendered":"JavaScript Custom Select Dropdown with Description"},"content":{"rendered":"<p>This code creates a custom select-option dropdown with description using CSS and Vanilla JavaScript. It replaces the standard select-option menu with radio buttons and labels to display relevant information. The user can select an option, and the chosen content is displayed.<\/p>\n<p>It enhances user experience by providing detailed descriptions for each option, making it easier for users to select the right choice. Moreover, you can customize the <a href=\"https:\/\/codehim.com\/text-input\/custom-select-dropdown-css-only\/\" target=\"_blank\" rel=\"noopener\">select dropdown<\/a> with additional CSS according to your needs.<\/p>\n<h2>How to Create Custom Select Dropdown with Description in JavaScript<\/h2>\n<p>1. First, create the HTML structure for the select dropdown as follows. Replace &#8220;Option Title&#8221; and &#8220;Option Description&#8221; with your specific content. You can add more options by duplicating this structure.<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;div class=\"container\"&gt;\r\n\t&lt;div class=\"top-text-wrapper\"&gt;\r\n\t\t&lt;h2&gt;Select Option Dropdown with CSS &amp; Vanilla JS&lt;\/h2&gt;\r\n\t\t&lt;p&gt;Custom select-option dropdown menu instead &lt;code&gt;select-option&lt;\/code&gt;. Here I use &lt;code&gt;input[type=radio]&lt;\/code&gt; and &lt;code&gt;label&lt;\/code&gt; to store the required information to display&lt;\/p&gt;\r\n\t\t&lt;hr&gt;\r\n\t&lt;\/div&gt;\r\n\r\n\t&lt;div class=\"select-box\"&gt;\r\n\t\t&lt;div class=\"options-container\"&gt;          \r\n\t\t\t&lt;div class=\"option\"&gt;\r\n\t\t\t\t&lt;input\r\n\t\t\t\t\t\t\t type=\"radio\"\r\n\t\t\t\t\t\t\t class=\"radio\"\r\n\t\t\t\t\t\t\t id=\"grade-a\"\r\n\t\t\t\t\t\t\t name=\"category\"\r\n\t\t\t\t\t\t\t \/&gt;\r\n\t\t\t\t&lt;label for=\"grade-a\"&gt;\r\n\t\t\t\t\t&lt;h3&gt;Highest Grade&lt;\/h3&gt; \r\n\t\t\t\t\t&lt;h5&gt;Lorem ipsum dolor sit amet consectetur.&lt;\/h5&gt; \r\n\t\t\t\t&lt;\/label&gt;\r\n\t\t\t&lt;\/div&gt;\r\n\r\n\t\t\t&lt;div class=\"option\"&gt;\r\n\t\t\t\t&lt;input type=\"radio\" class=\"radio\" id=\"grade-b\" name=\"category\" \/&gt;\r\n\t\t\t\t&lt;label for=\"grade-b\"&gt;\r\n\t\t\t\t\t&lt;h3&gt;Average Grade&lt;\/h3&gt; \r\n\t\t\t\t\t&lt;h5&gt;Individual and want to spread knowledge &lt;\/h5&gt; \r\n\t\t\t\t&lt;\/label&gt;\r\n\t\t\t&lt;\/div&gt;\r\n\r\n\t\t\t&lt;div class=\"option\"&gt;\r\n\t\t\t\t&lt;input type=\"radio\" class=\"radio\" id=\"grade-c\" name=\"category\" \/&gt;\r\n\t\t\t\t&lt;label for=\"grade-c\"&gt;\r\n\t\t\t\t\t&lt;h3&gt;Below Average Grade&lt;\/h3&gt; \r\n\t\t\t\t\t&lt;h5&gt;Lorem ipsum dolor sit amet consectetur adipisicing.&lt;\/h5&gt; \r\n\t\t\t\t&lt;\/label&gt;\r\n\t\t\t&lt;\/div&gt;\r\n\t\t\t&lt;div class=\"option\"&gt;\r\n\t\t\t\t&lt;input type=\"radio\" class=\"radio\" id=\"grade-c\" name=\"category\" \/&gt;\r\n\t\t\t\t&lt;label for=\"grade-c\"&gt;\r\n\t\t\t\t\t&lt;h3&gt;Poor Grade&lt;\/h3&gt; \r\n\t\t\t\t\t&lt;h5&gt;Individual and want to spread knowledge&lt;\/h5&gt; \r\n\t\t\t\t&lt;\/label&gt;\r\n\t\t\t&lt;\/div&gt;\r\n\t\t&lt;\/div&gt;\r\n\t\t&lt;div class=\"selected\"&gt;\r\n\t\t\t&lt;h3&gt;Highest Grade&lt;\/h3&gt; \r\n\t\t\t&lt;h5&gt;Individual and want to spread knowledge &lt;\/h5&gt;\r\n\t\t\t&lt;!-- &lt;svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" id=\"icon-arrow\" width=\"14\" height=\"8\"&gt;\r\n\t\t\t\t\t\t&lt;path d=\"M13.508.174a.57.57 0 00-.809 0l-5.86 6.43L.976.175a.57.57 0 00-.81 0 .577.577 0 000 .813l6.238 6.844c.119.12.277.17.433.163a.564.564 0 00.433-.163L13.508.987a.577.577 0 000-.813z\"\/&gt;\r\n\t\t\t\t\t&lt;\/svg&gt; --&gt;\r\n\t\t&lt;\/div&gt; \r\n\t&lt;\/div&gt;\r\n\t&lt;!-- \t\t\/.select-box --&gt;\r\n&lt;\/div&gt;\r\n&lt;!-- \t\t\/.container --&gt;<\/pre>\n<p>2. Now, include the necessary CSS styles in your HTML file or link to an external CSS file. These styles define the appearance of your custom select dropdown. You can use the following CSS code or customize it to match your design.<\/p>\n<pre class=\"prettyprint linenums lang-css\">@import url('https:\/\/fonts.googleapis.com\/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&amp;display=swap');\r\n* {\r\n  margin: 0;\r\n  box-sizing: border-box;\r\n}\r\n\r\nbody{\r\n  font-family: 'Open Sans', sans-serif;\r\n  font-size: 15px;\r\n  line-height: 1.5;\r\n  font-weight: 400;\r\n  background: #f0f3f6;\r\n  color: #3a3a3a;\r\n}\r\nhr {\r\n  margin: 20px 0;\r\n  border: none;\r\n  border-bottom: 1px solid #d9d9d9;\r\n}\r\nlabel, input{\r\n\tcursor: pointer;\r\n}\r\nh2,h3,h4,h5{\r\n\tfont-weight: 600;\r\n\tline-height: 1.3;\r\n\tcolor: #1f2949;\r\n}\r\nh2{\r\n\tfont-size: 24px;\r\n}\r\nh3 {\r\n\tfont-size: 18px;\r\n}\r\nh4 {\r\n\tfont-size: 14px;\r\n}\r\nh5 {\r\n\tfont-size: 12px;\r\n\tfont-weight: 400;\r\n}\r\nimg{\r\n\tmax-width: 100%;\r\n\tdisplay: block;\r\n\tvertical-align: middle;\r\n}\r\n\r\n.container {\r\n  padding: 0 15px;\r\n\tdisplay: grid;\r\n\tgrid-template-columns: 1fr;\r\n\tplace-items: center;\r\n}\r\n\r\n.top-text-wrapper {\r\n\tmargin: 20px 0 30px 0;\r\n}\r\n.top-text-wrapper h4{\r\n\tfont-size: 24px;\r\n  margin-bottom: 10px;\r\n}\r\n.top-text-wrapper code{\r\n  font-size: .85em;\r\n  background: linear-gradient(90deg,#fce3ec,#ffe8cc);\r\n  color: #ff2200;\r\n  padding: .1rem .3rem .2rem;\r\n  border-radius: .2rem;\r\n}\r\n.tab-section-wrapper{\r\n  padding: 30px 0;\r\n}\r\n\r\n.select-box {\r\n  display: flex;\r\n  width: 400px;\r\n  flex-direction: column;\r\n\tposition: relative;\r\n}\r\n\r\n.select-box .options-container {\r\n  max-height: 0;\r\n  width: calc( 100% - 12px);\r\n  opacity: 0;\r\n  transition: all 0.4s;\r\n  overflow: hidden;\r\n  border-radius: 5px;\r\n  border: solid 1px #dcdfe5;\r\n  background-color: #ffffff;\r\n  order: 1;\r\n\tposition: absolute;\r\n\ttop: 68px;\r\n  box-sizing: border-box;\r\n}\r\n\r\n.selected {\r\n  background: #2f3640;\r\n  margin-bottom: 8px;\r\n  position: relative;\r\n  width: 388px;\r\n  height: 64px;\r\n  border-radius: 5px;\r\n  border: solid 1px #dcdfe5;\r\n  background-color: #ffffff;\r\n  order: 0;\r\n}\r\n\r\n.selected::after {\r\n\t\/* Font Awesome\t *\/\r\n\tcontent: \"\u2304\";\r\n\tfont-weight: 900;\r\n\t-webkit-font-smoothing: antialiased;\r\n\tdisplay: inline-block;\r\n\tfont-style: normal;\r\n\tfont-variant: normal;\r\n\ttext-rendering: auto;\r\n\tline-height: 1;\r\n\t\/* BG Img\t *\/\r\n\/* \tcontent:  url(\"img\/arrow-down.svg\");\t *\/\r\n\tposition: absolute;\r\n\tright: 15px;\r\n\ttop: 50%;\r\n\ttransition: transform .5s;\r\n\ttransform: translateY(-50%);\r\n}\r\n\r\n\r\n.selected h3, .select-box label h3 {\r\n  font-family: \"Open Sans\", sans-serif;\r\n  font-size: 14px;\r\n  font-weight: 400;\r\n  line-height: 1.57;\r\n  color: #1f2949;\r\n}\r\n.selected h5, .select-box label h5{\r\n  font-family: \"Open Sans\", sans-serif;\r\n  font-size: 12px;\r\n  font-weight: 400;\r\n  line-height: 1.83;\r\n  color: #81878f;\r\n} \r\n\r\n.select-box .options-container.active {\r\n  max-height: 240px;\r\n  opacity: 1;\r\n  overflow-y: scroll;\r\n}\r\n\r\n.select-box .options-container.active + .selected::after {\r\n  transform: translateY(-50%) rotateX(180deg);\r\n}\r\n\r\n.select-box .options-container::-webkit-scrollbar {\r\n  width: 8px;\r\n  background: #0d141f;\r\n  background: #81878f;\r\n  background: #f1f2f3;\r\n  border-radius: 0 5px 5px 0;\r\n}\r\n\r\n.select-box .options-container::-webkit-scrollbar-thumb {\r\n  background: #525861;\r\n  background: #81878f;\r\n  border-radius: 0 5px 5px 0;\r\n}\r\n.select-box .option,\r\n.selected {\r\n  padding: 12px 24px;\r\n  cursor: pointer;\r\n}\r\n\r\n.select-box .option:hover {\r\n  background: #dcdfe5;\r\n}\r\n\r\n.select-box label {\r\n  cursor: pointer;\r\n}\r\n\r\n.select-box .option .radio {\r\n  display: none;\r\n}<\/pre>\n<p>3. Finally, add the JavaScript code to enable user interaction. This code allows users to click on options and see their descriptions in the selected area. Insert the provided JavaScript code in your HTML file, just before the closing <code>&lt;\/body&gt;<\/code> tag.<\/p>\n<pre class=\"prettyprint linenums lang-js\">const selected = document.querySelector(\".selected\");\r\nconst optionsContainer = document.querySelector(\".options-container\");\r\nconst optionsList = document.querySelectorAll(\".option\");\r\n\r\nselected.addEventListener(\"click\", () =&gt; {\r\n\toptionsContainer.classList.toggle(\"active\");\r\n});\r\n\r\noptionsList.forEach(option =&gt; {\r\n\toption.addEventListener(\"click\", () =&gt; {\r\n\t\tselected.innerHTML = option.querySelector(\"label\").innerHTML;\r\n\t\toptionsContainer.classList.remove(\"active\");\r\n\t});\r\n});<\/pre>\n<p>That&#8217;s it! You&#8217;ve successfully created a custom select dropdown with descriptions using JavaScript. This user-friendly interface enhances the selection process on your website or web application. If you have any questions or suggestions, feel free to comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This code creates a custom select-option dropdown with description using CSS and Vanilla JavaScript. It replaces the standard select-option menu&#8230;<\/p>\n","protected":false},"author":1,"featured_media":9372,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[97],"tags":[219],"class_list":["post-9371","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-text-input","tag-select-dropdown"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JavaScript Custom Select Dropdown with Description &#8212; CodeHim<\/title>\n<meta name=\"description\" content=\"Here is a free code snippet to create a JavaScript Custom Select Dropdown with Description. You can view demo and download the source code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Custom Select Dropdown with Description &#8212; CodeHim\" \/>\n<meta property=\"og:description\" content=\"Here is a free code snippet to create a JavaScript Custom Select Dropdown with Description. You can view demo and download the source code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeHim\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codehimofficial\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-14T18:01:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-22T11:02:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Custom-Select-Dropdown-with-Description.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"960\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Asif Mughal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:site\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Asif Mughal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/\"},\"author\":{\"name\":\"Asif Mughal\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\"},\"headline\":\"JavaScript Custom Select Dropdown with Description\",\"datePublished\":\"2024-01-14T18:01:00+00:00\",\"dateModified\":\"2024-01-22T11:02:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/\"},\"wordCount\":242,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Custom-Select-Dropdown-with-Description.png\",\"keywords\":[\"Select Dropdown\"],\"articleSection\":[\"Text &amp; Input\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/\",\"url\":\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/\",\"name\":\"JavaScript Custom Select Dropdown with Description &#8212; CodeHim\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Custom-Select-Dropdown-with-Description.png\",\"datePublished\":\"2024-01-14T18:01:00+00:00\",\"dateModified\":\"2024-01-22T11:02:23+00:00\",\"description\":\"Here is a free code snippet to create a JavaScript Custom Select Dropdown with Description. You can view demo and download the source code.\",\"breadcrumb\":{\"@id\":\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#primaryimage\",\"url\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Custom-Select-Dropdown-with-Description.png\",\"contentUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Custom-Select-Dropdown-with-Description.png\",\"width\":1280,\"height\":960,\"caption\":\"JavaScript Custom Select Dropdown with Description\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codehim.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Text &amp; Input\",\"item\":\"https:\/\/codehim.com\/category\/text-input\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"JavaScript Custom Select Dropdown with Description\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codehim.com\/#website\",\"url\":\"https:\/\/codehim.com\/\",\"name\":\"CodeHim\",\"description\":\"Web Design Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"alternateName\":\"Web Design Codes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codehim.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/codehim.com\/#organization\",\"name\":\"CodeHim - Web Design Code & Scripts\",\"url\":\"https:\/\/codehim.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"contentUrl\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"width\":280,\"height\":280,\"caption\":\"CodeHim - Web Design Code & Scripts\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/codehimofficial\",\"https:\/\/x.com\/CodeHimOfficial\",\"https:\/\/www.instagram.com\/codehim\/\",\"https:\/\/www.linkedin.com\/company\/codehim\",\"https:\/\/co.pinterest.com\/codehim\/\",\"https:\/\/www.youtube.com\/@codehim\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\",\"name\":\"Asif Mughal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"caption\":\"Asif Mughal\"},\"description\":\"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.\",\"sameAs\":[\"https:\/\/codehim.com\"],\"url\":\"https:\/\/codehim.com\/author\/asif-mughal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JavaScript Custom Select Dropdown with Description &#8212; CodeHim","description":"Here is a free code snippet to create a JavaScript Custom Select Dropdown with Description. You can view demo and download the source code.","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:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Custom Select Dropdown with Description &#8212; CodeHim","og_description":"Here is a free code snippet to create a JavaScript Custom Select Dropdown with Description. You can view demo and download the source code.","og_url":"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/","og_site_name":"CodeHim","article_publisher":"https:\/\/www.facebook.com\/codehimofficial","article_published_time":"2024-01-14T18:01:00+00:00","article_modified_time":"2024-01-22T11:02:23+00:00","og_image":[{"width":1280,"height":960,"url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Custom-Select-Dropdown-with-Description.png","type":"image\/png"}],"author":"Asif Mughal","twitter_card":"summary_large_image","twitter_creator":"@CodeHimOfficial","twitter_site":"@CodeHimOfficial","twitter_misc":{"Written by":"Asif Mughal","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#article","isPartOf":{"@id":"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/"},"author":{"name":"Asif Mughal","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed"},"headline":"JavaScript Custom Select Dropdown with Description","datePublished":"2024-01-14T18:01:00+00:00","dateModified":"2024-01-22T11:02:23+00:00","mainEntityOfPage":{"@id":"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/"},"wordCount":242,"commentCount":0,"publisher":{"@id":"https:\/\/codehim.com\/#organization"},"image":{"@id":"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Custom-Select-Dropdown-with-Description.png","keywords":["Select Dropdown"],"articleSection":["Text &amp; Input"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/","url":"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/","name":"JavaScript Custom Select Dropdown with Description &#8212; CodeHim","isPartOf":{"@id":"https:\/\/codehim.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#primaryimage"},"image":{"@id":"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Custom-Select-Dropdown-with-Description.png","datePublished":"2024-01-14T18:01:00+00:00","dateModified":"2024-01-22T11:02:23+00:00","description":"Here is a free code snippet to create a JavaScript Custom Select Dropdown with Description. You can view demo and download the source code.","breadcrumb":{"@id":"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#primaryimage","url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Custom-Select-Dropdown-with-Description.png","contentUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Custom-Select-Dropdown-with-Description.png","width":1280,"height":960,"caption":"JavaScript Custom Select Dropdown with Description"},{"@type":"BreadcrumbList","@id":"https:\/\/codehim.com\/text-input\/javascript-custom-select-dropdown-with-description\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codehim.com\/"},{"@type":"ListItem","position":2,"name":"Text &amp; Input","item":"https:\/\/codehim.com\/category\/text-input\/"},{"@type":"ListItem","position":3,"name":"JavaScript Custom Select Dropdown with Description"}]},{"@type":"WebSite","@id":"https:\/\/codehim.com\/#website","url":"https:\/\/codehim.com\/","name":"CodeHim","description":"Web Design Code Snippets","publisher":{"@id":"https:\/\/codehim.com\/#organization"},"alternateName":"Web Design Codes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codehim.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codehim.com\/#organization","name":"CodeHim - Web Design Code & Scripts","url":"https:\/\/codehim.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/","url":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","contentUrl":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","width":280,"height":280,"caption":"CodeHim - Web Design Code & Scripts"},"image":{"@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codehimofficial","https:\/\/x.com\/CodeHimOfficial","https:\/\/www.instagram.com\/codehim\/","https:\/\/www.linkedin.com\/company\/codehim","https:\/\/co.pinterest.com\/codehim\/","https:\/\/www.youtube.com\/@codehim"]},{"@type":"Person","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed","name":"Asif Mughal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","caption":"Asif Mughal"},"description":"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.","sameAs":["https:\/\/codehim.com"],"url":"https:\/\/codehim.com\/author\/asif-mughal\/"}]}},"views":1428,"_links":{"self":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/9371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/comments?post=9371"}],"version-history":[{"count":0,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/9371\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media\/9372"}],"wp:attachment":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media?parent=9371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/categories?post=9371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/tags?post=9371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}