<?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>Codepolice.net &#187; html</title>
	<atom:link href="http://codepolice.net/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://codepolice.net</link>
	<description>C#, ASP.NET, MVC, LINQ, Wordpress and stuff like that</description>
	<lastBuildDate>Mon, 26 Jul 2010 08:58:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Convert all checked checkboxes into an comma seperated string with JQuery</title>
		<link>http://codepolice.net/2009/11/07/convert-all-checked-checkboxes-into-an-comma-seperated-string-with-jquery/</link>
		<comments>http://codepolice.net/2009/11/07/convert-all-checked-checkboxes-into-an-comma-seperated-string-with-jquery/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 15:30:00 +0000</pubDate>
		<dc:creator>Ola</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[checkboxes]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://codepolice.net/?p=178</guid>
		<description><![CDATA[Sometimes i just love jQuery. Well most of the time actually. I did some work for a client a couple of week ago and i needed get all checkoboxes that was checked as a comma seperated list. I started with this code. I found out about the &#8220;map&#8221; method of jQuery wich has the following [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes i just love jQuery. Well most of the time actually. I did some work for a client a couple of week ago and i needed get all checkoboxes that was checked as a comma seperated list. I started with this code. I found out about the &#8220;map&#8221; method of jQuery wich has the following description.</p>
<blockquote>
<div>Translate all items in an array to another array of items.</div>
<p>The translation function that is provided to this method is called for each item in the array and is passed two arguments: The the item to be translated, and index within the array.The function can then return the translated value, &#8216;null&#8217; (to remove the item), or an array of values &#8211; which will be flattened into the full array.</p></blockquote>
<p>The code i ended up with looked like this. Really really neat.</p>
<pre class="brush:js">
<input type="checkbox" value="1" class="chk" />
<input type="checkbox" value="2" class="chk" />
<input type="checkbox" value="3" class="chk" />
<input type="checkbox" value="4" class="chk" />
<input type="checkbox" value="5" class="chk" />
    <span id="show"></span>
    <script type="text/javascript">
        $(document).ready(function () {
            CheckSelected();
        });
        $('.chk').click(function () {
            CheckSelected();
        });
        function CheckSelected() {
            var idArray = $('.chk:checked').map(function () {
                return $(this).val();
            });
            $("#show").text($.makeArray(idArray).join(','));
        }
    </script></pre>
]]></content:encoded>
			<wfw:commentRss>http://codepolice.net/2009/11/07/convert-all-checked-checkboxes-into-an-comma-seperated-string-with-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->