<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>jquery-dropdown &#8211; Extreme Web Designs</title>
	<atom:link href="https://theextremewebdesigns.com/blog/tag/jquery-dropdown/feed/" rel="self" type="application/rss+xml" />
	<link>https://theextremewebdesigns.com/blog</link>
	<description>Web Design and Web Development</description>
	<lastBuildDate>Wed, 20 Jun 2012 04:36:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.5</generator>
<site xmlns="com-wordpress:feed-additions:1">156673191</site>	<item>
		<title>jQuery Set Dropdown Value Examples</title>
		<link>https://theextremewebdesigns.com/blog/jquery-set-dropdown-value-set-dropdown-value-using-jquery-examples/</link>
					<comments>https://theextremewebdesigns.com/blog/jquery-set-dropdown-value-set-dropdown-value-using-jquery-examples/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 20 Jun 2012 04:36:50 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<category><![CDATA[jquery-dropdown]]></category>
		<category><![CDATA[jquery-set-dropdown-value]]></category>
		<category><![CDATA[jquery-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=943</guid>

					<description><![CDATA[If you are wondering how to use jQuery to set dropdown value using jQuery, then look no further! In this article, I am going to share some examples that show how to easily set dropdown value. How to use jQuery to Set Dropdown Value The following is the HTML source code of the example. It [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you are wondering <em><strong>how to use jQuery to set dropdown value using jQuery</strong></em>, then look no further! In this article, I am going to share some examples that show how to easily set dropdown value.</p>
<p><span id="more-943"></span></p>
<h2>How to use jQuery to Set Dropdown Value</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=943" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>The following is the HTML source code of the example. It assumes that there is a dropdown box with ID &#8220;country&#8221; and the  value of the dropdown needs to be set to a different value when a button is clicked.</p>
<h3>Common HTML Code for all following examples:</h3>
<pre class="lang:xhtml decode:true">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;jQuery Set Dropdown Value | Set Dropdown Value using jQuery Examples&lt;/title&gt;
&lt;script type="text/javascript" src="js/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;select name="country" id="country"&gt;
&lt;option value="Australia"&gt;Australia&lt;/option&gt;
&lt;option value="London"&gt;London&lt;/option&gt;
&lt;option value="USA"&gt;USA&lt;/option&gt;
&lt;/select&gt;
&lt;input type="submit" name="set" id="set" value="Set USA as country" /&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
<h3>Example 1: Set Dropdown Value using val() method using jQuery</h3>
<pre class="lang:xhtml decode:true">&lt;script type="text/javascript"&gt;

$('#set').click(function() {

$("#country").val("USA");

});

&lt;/script&gt;</pre>
<h3>Example 2: Set Dropdown Value using attr selectedIndex using jQuery (Works only when jQuery version &lt; 1.6)</h3>
<pre class="lang:xhtml decode:true">&lt;script type="text/javascript"&gt;

$('#set').click(function() {

$("#country").attr('selectedIndex', 2);

});

&lt;/script&gt;</pre>
<h3>Example 3: Set Dropdown Value using attr selectedIndex using jQuery (Works only when jQuery version &gt;= 1.6)</h3>
<pre class="lang:xhtml decode:true">&lt;script type="text/javascript"&gt;

$('#set').click(function() {

$("#country").prop('selectedIndex', 2);

});

&lt;/script&gt;</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=943" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h5>That&#8217;s it!</h5>
<p>Do you know of any other ways to <em><strong>set dropdown value using jQuery</strong></em>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jquery-set-dropdown-value-set-dropdown-value-using-jquery-examples/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">943</post-id>	</item>
	</channel>
</rss>
