<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Javascript set selection in select element</title>
	<atom:link href="http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/</link>
	<description></description>
	<pubDate>Sat, 30 Aug 2008 04:47:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Robert S</title>
		<link>http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/#comment-578529</link>
		<dc:creator>Robert S</dc:creator>
		<pubDate>Sun, 15 Jun 2008 09:30:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/#comment-578529</guid>
		<description>Or use jQuery:
http://docs.jquery.com/Attributes/val#val</description>
		<content:encoded><![CDATA[<p>Or use jQuery:<br />
<a href="http://docs.jquery.com/Attributes/val#val" rel="nofollow">http://docs.jquery.com/Attributes/val#val</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: volomike</title>
		<link>http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/#comment-554125</link>
		<dc:creator>volomike</dc:creator>
		<pubDate>Wed, 12 Mar 2008 01:10:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/#comment-554125</guid>
		<description>Was looking for this script. Too bad you don't have ads on this site -- I would have clicked on all your ads as a form of thank you. 

(You really should sign up with Google AdSense if you're going to post this kind of stuff. I just started last month and with just one blog and without even trying, I managed to get $20. Imagine if I had dozens of blogs, useful info like this, and actually made an effort at it.)</description>
		<content:encoded><![CDATA[<p>Was looking for this script. Too bad you don&#8217;t have ads on this site &#8212; I would have clicked on all your ads as a form of thank you. </p>
<p>(You really should sign up with Google AdSense if you&#8217;re going to post this kind of stuff. I just started last month and with just one blog and without even trying, I managed to get $20. Imagine if I had dozens of blogs, useful info like this, and actually made an effort at it.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will</title>
		<link>http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/#comment-526955</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Mon, 27 Aug 2007 14:38:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/#comment-526955</guid>
		<description>Was looking for just this script.  Thank you for saving me 3 hours.</description>
		<content:encoded><![CDATA[<p>Was looking for just this script.  Thank you for saving me 3 hours.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick</title>
		<link>http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/#comment-501621</link>
		<dc:creator>Rick</dc:creator>
		<pubDate>Thu, 01 Mar 2007 15:53:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/#comment-501621</guid>
		<description>Thanks to all.  This works like a champ.  I had several drop-down selects, and gave the options an id in the form of [id of select].[id of option] to keep them straight.</description>
		<content:encoded><![CDATA[<p>Thanks to all.  This works like a champ.  I had several drop-down selects, and gave the options an id in the form of [id of select].[id of option] to keep them straight.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Becky</title>
		<link>http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/#comment-498541</link>
		<dc:creator>Becky</dc:creator>
		<pubDate>Wed, 07 Feb 2007 23:39:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/#comment-498541</guid>
		<description>Oops.  Looks like some of my comment got eaten.  

My example should have been ... 

[option value="1" id="option1"]option 1[/option]
[option value="2" id="option2"]option 2[/option]
[option value="3" id="option3"]option 3[/option]</description>
		<content:encoded><![CDATA[<p>Oops.  Looks like some of my comment got eaten.  </p>
<p>My example should have been &#8230; </p>
<p>[option value="1" id="option1"]option 1[/option]<br />
[option value="2" id="option2"]option 2[/option]<br />
[option value="3" id="option3"]option 3[/option]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Becky</title>
		<link>http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/#comment-498415</link>
		<dc:creator>Becky</dc:creator>
		<pubDate>Wed, 07 Feb 2007 01:19:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2007/02/06/javascript-set-selection-in-select-element/#comment-498415</guid>
		<description>If you give the options an id, then you can use that to set the selected value.  A co-worker of mine figured out how to go about it, and I've used it myself.

For example, if you have the following:
option 1
option 2
option 3

And you want to select the option with a value of "2", you can do:
document.getElementById("option2").selected = true;

If you name your options in a consistant, predictable manner, then it's not too difficult to do.

I hope that helps (and that I made sense explaining it).</description>
		<content:encoded><![CDATA[<p>If you give the options an id, then you can use that to set the selected value.  A co-worker of mine figured out how to go about it, and I&#8217;ve used it myself.</p>
<p>For example, if you have the following:<br />
option 1<br />
option 2<br />
option 3</p>
<p>And you want to select the option with a value of &#8220;2&#8243;, you can do:<br />
document.getElementById(&#8221;option2&#8243;).selected = true;</p>
<p>If you name your options in a consistant, predictable manner, then it&#8217;s not too difficult to do.</p>
<p>I hope that helps (and that I made sense explaining it).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.273 seconds -->
