<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Tip: getting values from an options list</title>
	<atom:link href="http://yelotofu.com/2009/10/tip-getting-values-from-an-options-list/feed/" rel="self" type="application/rss+xml" />
	<link>http://yelotofu.com/2009/10/tip-getting-values-from-an-options-list/</link>
	<description>"In building standards compliant sites we are creating a better Web for the future."</description>
	<lastBuildDate>Thu, 29 Jul 2010 11:04:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Cloudgen</title>
		<link>http://yelotofu.com/2009/10/tip-getting-values-from-an-options-list/comment-page-1/#comment-12286</link>
		<dc:creator>Cloudgen</dc:creator>
		<pubDate>Fri, 14 May 2010 01:56:49 +0000</pubDate>
		<guid isPermaLink="false">http://yelotofu.com/?p=579#comment-12286</guid>
		<description>Less code means less bandwidth and more efficiency in usage of cache for high traffic website (less hacking risk, less risk in DDOS attack, etc). Let&#039;s client&#039;s computers do the rest  (that&#039;s the philosophy of Client-Side Javascript).  So, as a software engineer from a B2B firm, I prefer one line version:

var values=$.map($(&#039;#mySelectElement&#039;)[0].options, function(n){return n.value});

:P</description>
		<content:encoded><![CDATA[<p>Less code means less bandwidth and more efficiency in usage of cache for high traffic website (less hacking risk, less risk in DDOS attack, etc). Let&#8217;s client&#8217;s computers do the rest  (that&#8217;s the philosophy of Client-Side Javascript).  So, as a software engineer from a B2B firm, I prefer one line version:</p>
<p>var values=$.map($(&#8216;#mySelectElement&#8217;)[0].options, function(n){return n.value});</p>
<p> <img src='http://yelotofu.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: caphun</title>
		<link>http://yelotofu.com/2009/10/tip-getting-values-from-an-options-list/comment-page-1/#comment-8941</link>
		<dc:creator>caphun</dc:creator>
		<pubDate>Thu, 22 Oct 2009 09:38:32 +0000</pubDate>
		<guid isPermaLink="false">http://yelotofu.com/?p=579#comment-8941</guid>
		<description>@dalin: Yes, definitely. Using values[] would be quicker than push but in most cases you won&#039;t notice. If I were wearing my optimization hat I&#039;d also use &lt;code&gt;document.getElementById(&#039;mySelectElement&#039;)&lt;/code&gt; to add to that.

jQuery.map at its heart is a for loop with a callback. That&#039;s all it is. I see option one as a common pattern we run into often and option 2 as a possible solution to that pattern.</description>
		<content:encoded><![CDATA[<p>@dalin: Yes, definitely. Using values[] would be quicker than push but in most cases you won&#8217;t notice. If I were wearing my optimization hat I&#8217;d also use <code>document.getElementById('mySelectElement')</code> to add to that.</p>
<p>jQuery.map at its heart is a for loop with a callback. That&#8217;s all it is. I see option one as a common pattern we run into often and option 2 as a possible solution to that pattern.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dalin</title>
		<link>http://yelotofu.com/2009/10/tip-getting-values-from-an-options-list/comment-page-1/#comment-8937</link>
		<dc:creator>dalin</dc:creator>
		<pubDate>Thu, 22 Oct 2009 07:06:36 +0000</pubDate>
		<guid isPermaLink="false">http://yelotofu.com/?p=579#comment-8937</guid>
		<description>If this was PHP I would say &quot;bad idea&quot;.  But I know much less about JavaScript so perhaps it&#039;s not.  

in option 1 you use language constructs (I would think it would be even better to use values[] rather than the method .push).  In option 2 you use a method to run a callback function on each element.  I&#039;m guessing there&#039;s an order of magnitude difference in performance (if not more).  Albeit with a select box there&#039;s probably not too many options to iterate through, but other scenarios may have significantly more.</description>
		<content:encoded><![CDATA[<p>If this was PHP I would say &#8220;bad idea&#8221;.  But I know much less about JavaScript so perhaps it&#8217;s not.  </p>
<p>in option 1 you use language constructs (I would think it would be even better to use values[] rather than the method .push).  In option 2 you use a method to run a callback function on each element.  I&#8217;m guessing there&#8217;s an order of magnitude difference in performance (if not more).  Albeit with a select box there&#8217;s probably not too many options to iterate through, but other scenarios may have significantly more.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
