{"id":229703,"date":"2024-03-30T05:08:13","date_gmt":"2024-03-30T05:08:13","guid":{"rendered":"https:\/\/namso-gen.co\/blog\/?p=229703"},"modified":"2024-03-30T05:08:13","modified_gmt":"2024-03-30T05:08:13","slug":"how-to-set-default-selected-value-in-dropdown-using-jquery","status":"publish","type":"post","link":"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/","title":{"rendered":"How to set default selected value in dropdown using jQuery?"},"content":{"rendered":"<p>jQuery is a popular JavaScript library that makes it easier to manipulate HTML elements and add interactivity to web pages. One common task often encountered when working with forms is setting default selected values in dropdown menus. In this article, we will explore how to achieve this using jQuery. So, let&#8217;s dive in!<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_62 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#How_to_set_default_selected_value_in_dropdown_using_jQuery\" title=\"How to set default selected value in dropdown using jQuery?\">How to set default selected value in dropdown using jQuery?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#Can_I_set_the_default_selected_value_using_the_options_text_instead_of_its_value\" title=\"Can I set the default selected value using the option&#8217;s text instead of its value?\">Can I set the default selected value using the option&#8217;s text instead of its value?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#What_if_my_dropdown_is_dynamically_loaded_or_populated\" title=\"What if my dropdown is dynamically loaded or populated?\">What if my dropdown is dynamically loaded or populated?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#How_can_I_set_the_default_selected_value_in_a_multiple_select_dropdown\" title=\"How can I set the default selected value in a multiple select dropdown?\">How can I set the default selected value in a multiple select dropdown?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#Is_it_possible_to_set_the_default_selected_option_based_on_a_condition\" title=\"Is it possible to set the default selected option based on a condition?\">Is it possible to set the default selected option based on a condition?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#What_if_the_default_value_is_not_present_in_the_dropdown\" title=\"What if the default value is not present in the dropdown?\">What if the default value is not present in the dropdown?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#Can_I_use_jQuery_to_set_the_default_selected_option_in_a_dropdown_without_an_ID\" title=\"Can I use jQuery to set the default selected option in a dropdown without an ID?\">Can I use jQuery to set the default selected option in a dropdown without an ID?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#How_can_I_reset_the_selected_value_in_a_dropdown_to_its_default_state\" title=\"How can I reset the selected value in a dropdown to its default state?\">How can I reset the selected value in a dropdown to its default state?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#Can_I_set_the_default_selected_value_of_a_dropdown_on_page_load\" title=\"Can I set the default selected value of a dropdown on page load?\">Can I set the default selected value of a dropdown on page load?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#Can_I_change_the_default_selected_value_dynamically_based_on_user_interaction\" title=\"Can I change the default selected value dynamically based on user interaction?\">Can I change the default selected value dynamically based on user interaction?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#Is_it_possible_to_style_the_default_selected_option_differently_from_other_options\" title=\"Is it possible to style the default selected option differently from other options?\">Is it possible to style the default selected option differently from other options?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#Can_I_set_the_default_selected_value_in_a_dropdown_without_using_jQuery\" title=\"Can I set the default selected value in a dropdown without using jQuery?\">Can I set the default selected value in a dropdown without using jQuery?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"How_to_set_default_selected_value_in_dropdown_using_jQuery\"><\/span>How to set default selected value in dropdown using jQuery?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To set a default selected value in a dropdown using jQuery, you can utilize the `val()` function along with the `:selected` selector. Here&#8217;s an example:<\/p>\n<p>&#8220;`javascript<br \/>\n$(document).ready(function(){<br \/>\n  \/\/ Get the dropdown element by its ID<br \/>\n  var dropdown = $(&#8216;#myDropdown&#8217;);<\/p>\n<p>  \/\/ Set the desired default option value<br \/>\n  var defaultValue = &#8216;option2&#8217;;<\/p>\n<p>  \/\/ Set the default selected value<br \/>\n  dropdown.val(defaultValue);<br \/>\n});<br \/>\n&#8220;`<\/p>\n<p>In the above example, the `val()` function is used to set the value of the dropdown element to the desired default value, which in this case is `&#8217;option2&#8217;`.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Can_I_set_the_default_selected_value_using_the_options_text_instead_of_its_value\"><\/span>Can I set the default selected value using the option&#8217;s text instead of its value?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nYes, it is possible to set the default selected value based on the option&#8217;s text. Instead of using `val()`, you can use the `:contains` selector to find the option element containing the desired text and then set its `selected` property to `true` using the `prop()` function.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"What_if_my_dropdown_is_dynamically_loaded_or_populated\"><\/span>What if my dropdown is dynamically loaded or populated?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nIf your dropdown is dynamically populated, make sure to set the default selected value after the dropdown options are loaded to ensure that the desired option exists before setting it as the default.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_can_I_set_the_default_selected_value_in_a_multiple_select_dropdown\"><\/span>How can I set the default selected value in a multiple select dropdown?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nFor multiple select dropdowns, you need to pass an array to the `val()` function, containing the values of the options you want to be selected by default.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Is_it_possible_to_set_the_default_selected_option_based_on_a_condition\"><\/span>Is it possible to set the default selected option based on a condition?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nYes, it is possible to set the default selected option based on a condition. You can use any JavaScript conditional statement before setting the default value to determine which option should be selected.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"What_if_the_default_value_is_not_present_in_the_dropdown\"><\/span>What if the default value is not present in the dropdown?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nIf the default value is not present in the dropdown, no option will be selected by default. It&#8217;s important to ensure that the default value exists as an option to avoid unexpected behavior.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Can_I_use_jQuery_to_set_the_default_selected_option_in_a_dropdown_without_an_ID\"><\/span>Can I use jQuery to set the default selected option in a dropdown without an ID?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nYes, you can select the dropdown element using any CSS selector that identifies it uniquely, such as a class, name attribute, or parent-child relationship.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_can_I_reset_the_selected_value_in_a_dropdown_to_its_default_state\"><\/span>How can I reset the selected value in a dropdown to its default state?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nTo reset the selected value in a dropdown to its default state, you can use the `val()` function without any arguments, which will remove the selection and reset it to the initial state.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Can_I_set_the_default_selected_value_of_a_dropdown_on_page_load\"><\/span>Can I set the default selected value of a dropdown on page load?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nYes, you can set the default selected value of a dropdown on page load by placing the code inside the `$(document).ready()` function. This ensures that the code executes once the document is fully loaded.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Can_I_change_the_default_selected_value_dynamically_based_on_user_interaction\"><\/span>Can I change the default selected value dynamically based on user interaction?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nYes, you can change the default selected value dynamically based on user interaction. Use event handlers, such as the `change()` function, to detect user input and update the default selection accordingly.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Is_it_possible_to_style_the_default_selected_option_differently_from_other_options\"><\/span>Is it possible to style the default selected option differently from other options?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nCertainly! You can style the default selected option differently by applying CSS styles to the `option:checked` selector.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Can_I_set_the_default_selected_value_in_a_dropdown_without_using_jQuery\"><\/span>Can I set the default selected value in a dropdown without using jQuery?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nYes, it is possible to set the default selected value in a dropdown without using jQuery. You can achieve this by using pure JavaScript and manipulating the `value` and `selected` properties of the option element.<\/p>\n<p>In conclusion, by using jQuery, we can easily set the default selected value in a dropdown by utilizing the `val()` function along with the `:selected` selector. This offers a straightforward and efficient approach to achieve the desired functionality with minimal code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>jQuery is a popular JavaScript library that makes it easier to manipulate HTML elements and add interactivity to web pages. One common task often encountered when working with forms is setting default selected values in dropdown menus. In this article, we will explore how to achieve this using jQuery. So, let&#8217;s dive in! How to &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to set default selected value in dropdown using jQuery?\" class=\"read-more button\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#more-229703\">Read more<span class=\"screen-reader-text\">How to set default selected value in dropdown using jQuery?<\/span><\/a><\/p>\n","protected":false},"author":57,"featured_media":107420,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86279],"tags":[],"class_list":["post-229703","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-learn","no-featured-image-padding"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to set default selected value in dropdown using jQuery?<\/title>\n<meta name=\"description\" content=\"jQuery is a popular JavaScript library that makes it easier to manipulate HTML elements and add interactivity to web pages. One common task often\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to set default selected value in dropdown using jQuery?\" \/>\n<meta property=\"og:description\" content=\"jQuery is a popular JavaScript library that makes it easier to manipulate HTML elements and add interactivity to web pages. One common task often\" \/>\n<meta property=\"og:url\" content=\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/\" \/>\n<meta property=\"og:site_name\" content=\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/synchronyfinancial\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-30T05:08:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2024\/03\/faq.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Casey Mayer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@synchrony\" \/>\n<meta name=\"twitter:site\" content=\"@synchrony\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Casey Mayer\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/\"},\"author\":{\"name\":\"Casey Mayer\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/89e431077ef417dfaa131f435124f18f\"},\"headline\":\"How to set default selected value in dropdown using jQuery?\",\"datePublished\":\"2024-03-30T05:08:13+00:00\",\"dateModified\":\"2024-03-30T05:08:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/\"},\"wordCount\":691,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\"},\"articleSection\":[\"Learn\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/\",\"url\":\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/\",\"name\":\"How to set default selected value in dropdown using jQuery?\",\"isPartOf\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#website\"},\"datePublished\":\"2024-03-30T05:08:13+00:00\",\"dateModified\":\"2024-03-30T05:08:13+00:00\",\"description\":\"jQuery is a popular JavaScript library that makes it easier to manipulate HTML elements and add interactivity to web pages. One common task often\",\"breadcrumb\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/namso-gen.co\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to set default selected value in dropdown using jQuery?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#website\",\"url\":\"https:\/\/namso-gen.co\/blog\/\",\"name\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\",\"description\":\"In Namso gen blog you can get many tips regarding to Credit cards, VCC, Credit card security etc. You can generate credit cards by using Namso-gen.co\",\"publisher\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/namso-gen.co\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\",\"name\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\",\"url\":\"https:\/\/namso-gen.co\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png\",\"contentUrl\":\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png\",\"width\":500,\"height\":164,\"caption\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\"},\"image\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/synchronyfinancial\",\"https:\/\/twitter.com\/synchrony\",\"https:\/\/www.youtube.com\/synchronyfinancial\",\"https:\/\/www.instagram.com\/synchrony\",\"https:\/\/www.linkedin.com\/company\/synchrony-financial\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/89e431077ef417dfaa131f435124f18f\",\"name\":\"Casey Mayer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"caption\":\"Casey Mayer\"},\"description\":\"Guest author Casey Mayer has meticulously crafted and revised this article to the best of their knowledge and understanding. Readers are strongly advised to exercise caution, verify information independently, and rely on their own judgment when considering the information provided. Read more articles on Namso Gen here.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to set default selected value in dropdown using jQuery?","description":"jQuery is a popular JavaScript library that makes it easier to manipulate HTML elements and add interactivity to web pages. One common task often","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:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/","og_locale":"en_US","og_type":"article","og_title":"How to set default selected value in dropdown using jQuery?","og_description":"jQuery is a popular JavaScript library that makes it easier to manipulate HTML elements and add interactivity to web pages. One common task often","og_url":"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/","og_site_name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","article_publisher":"https:\/\/www.facebook.com\/synchronyfinancial","article_published_time":"2024-03-30T05:08:13+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2024\/03\/faq.png","type":"image\/png"}],"author":"Casey Mayer","twitter_card":"summary_large_image","twitter_creator":"@synchrony","twitter_site":"@synchrony","twitter_misc":{"Written by":"Casey Mayer","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#article","isPartOf":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/"},"author":{"name":"Casey Mayer","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/89e431077ef417dfaa131f435124f18f"},"headline":"How to set default selected value in dropdown using jQuery?","datePublished":"2024-03-30T05:08:13+00:00","dateModified":"2024-03-30T05:08:13+00:00","mainEntityOfPage":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/"},"wordCount":691,"commentCount":0,"publisher":{"@id":"https:\/\/namso-gen.co\/blog\/#organization"},"articleSection":["Learn"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/","url":"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/","name":"How to set default selected value in dropdown using jQuery?","isPartOf":{"@id":"https:\/\/namso-gen.co\/blog\/#website"},"datePublished":"2024-03-30T05:08:13+00:00","dateModified":"2024-03-30T05:08:13+00:00","description":"jQuery is a popular JavaScript library that makes it easier to manipulate HTML elements and add interactivity to web pages. One common task often","breadcrumb":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/namso-gen.co\/blog\/how-to-set-default-selected-value-in-dropdown-using-jquery\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/namso-gen.co\/blog\/"},{"@type":"ListItem","position":2,"name":"How to set default selected value in dropdown using jQuery?"}]},{"@type":"WebSite","@id":"https:\/\/namso-gen.co\/blog\/#website","url":"https:\/\/namso-gen.co\/blog\/","name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","description":"In Namso gen blog you can get many tips regarding to Credit cards, VCC, Credit card security etc. You can generate credit cards by using Namso-gen.co","publisher":{"@id":"https:\/\/namso-gen.co\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/namso-gen.co\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/namso-gen.co\/blog\/#organization","name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","url":"https:\/\/namso-gen.co\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png","contentUrl":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png","width":500,"height":164,"caption":"Namso Gen Blog - Free Credit Card Generator [100% Valid]"},"image":{"@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/synchronyfinancial","https:\/\/twitter.com\/synchrony","https:\/\/www.youtube.com\/synchronyfinancial","https:\/\/www.instagram.com\/synchrony","https:\/\/www.linkedin.com\/company\/synchrony-financial"]},{"@type":"Person","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/89e431077ef417dfaa131f435124f18f","name":"Casey Mayer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","caption":"Casey Mayer"},"description":"Guest author Casey Mayer has meticulously crafted and revised this article to the best of their knowledge and understanding. Readers are strongly advised to exercise caution, verify information independently, and rely on their own judgment when considering the information provided. Read more articles on Namso Gen here."}]}},"_links":{"self":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts\/229703","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/users\/57"}],"replies":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/comments?post=229703"}],"version-history":[{"count":0,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts\/229703\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/media\/107420"}],"wp:attachment":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/media?parent=229703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/categories?post=229703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/tags?post=229703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}