<?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: jQuery Tip : How to Select Radio/Checkbox Input On Click</title>
	<atom:link href="http://dev-tips.com/featured/jquery-tip-how-to-select-radiocheckbox-input-on-click/feed" rel="self" type="application/rss+xml" />
	<link>http://dev-tips.com/featured/jquery-tip-how-to-select-radiocheckbox-input-on-click</link>
	<description>Become a Better Developer, One Tip at a Time.</description>
	<lastBuildDate>Tue, 27 Sep 2011 18:42:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: anil</title>
		<link>http://dev-tips.com/featured/jquery-tip-how-to-select-radiocheckbox-input-on-click#comment-2021</link>
		<dc:creator>anil</dc:creator>
		<pubDate>Tue, 28 Jun 2011 20:58:57 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=80#comment-2021</guid>
		<description>Hi,

   What I have to do if my radio buttons are side by side?

   Thanks for Help.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>   What I have to do if my radio buttons are side by side?</p>
<p>   Thanks for Help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://dev-tips.com/featured/jquery-tip-how-to-select-radiocheckbox-input-on-click#comment-1982</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Thu, 10 Mar 2011 23:29:07 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=80#comment-1982</guid>
		<description>This is the exact script I was looking for however it is not functional with versions of jquery greater than 1.4.4

My solution was changing .click() attribute as shown below.

&lt;code&gt;
     
    $(document).ready(function(){
	$(&#039;span&#039;).click( function(){
		$(this).children(&#039;input:radio&#039;).attr(&quot;checked&quot;, true);
		});
	});
     
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>This is the exact script I was looking for however it is not functional with versions of jquery greater than 1.4.4</p>
<p>My solution was changing .click() attribute as shown below.</p>
<p><code></p>
<p>    $(document).ready(function(){<br />
	$('span').click( function(){<br />
		$(this).children('input:radio').attr("checked", true);<br />
		});<br />
	});</p>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dan</title>
		<link>http://dev-tips.com/featured/jquery-tip-how-to-select-radiocheckbox-input-on-click#comment-1935</link>
		<dc:creator>dan</dc:creator>
		<pubDate>Tue, 07 Dec 2010 10:02:55 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=80#comment-1935</guid>
		<description>Hi,

just what i needed ! but i am already using http://code.jquery.com/jquery-latest.js in my page which does not work with your script and 
http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js

i can not use!

do you know how to get it to work with jquery-latest.js??

hope there is away ??? and you can help....</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>just what i needed ! but i am already using <a href="http://code.jquery.com/jquery-latest.js" rel="nofollow">http://code.jquery.com/jquery-latest.js</a> in my page which does not work with your script and<br />
<a href="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" rel="nofollow">http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js</a></p>
<p>i can not use!</p>
<p>do you know how to get it to work with jquery-latest.js??</p>
<p>hope there is away ??? and you can help&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Some0ne</title>
		<link>http://dev-tips.com/featured/jquery-tip-how-to-select-radiocheckbox-input-on-click#comment-1847</link>
		<dc:creator>Some0ne</dc:creator>
		<pubDate>Sun, 15 Aug 2010 03:25:41 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=80#comment-1847</guid>
		<description>Im using this for radio options but need this for multiple radio options on same page? ...ive tried changing each id eg:

&lt;code&gt;$(&#039;li.radio&#039;).click( function(){&lt;/code&gt;
&lt;code&gt;$(&#039;li.radio2&#039;).click( function(){&lt;/code&gt;
&lt;code&gt;$(&#039;li.radio3&#039;).click( function(){&lt;/code&gt;
but that dosent seem to work ...</description>
		<content:encoded><![CDATA[<p>Im using this for radio options but need this for multiple radio options on same page? &#8230;ive tried changing each id eg:</p>
<p><code>$('li.radio').click( function(){</code><br />
<code>$('li.radio2').click( function(){</code><br />
<code>$('li.radio3').click( function(){</code><br />
but that dosent seem to work &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ziad</title>
		<link>http://dev-tips.com/featured/jquery-tip-how-to-select-radiocheckbox-input-on-click#comment-1733</link>
		<dc:creator>Ziad</dc:creator>
		<pubDate>Wed, 31 Mar 2010 13:01:30 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=80#comment-1733</guid>
		<description>Great tip Barry, thanks!

I was trying to do it the other way around but ran into some problem. The code works but only on the last radio button set. Not sure why:

&lt;code&gt;
$(
	function radioHighlight(radioName, className) {
		radioNameSelector = &quot;input[name=&#039;&quot; + radioName + &quot;&#039;]&quot;;
		$(radioNameSelector).click(function() {
			$(radioNameSelector).parent().removeClass(className);
			$(radioNameSelector + &#039;:checked&#039;).parent().addClass(className);
		});
	}	

	radioHighlight(&#039;beneficiary&#039;, &#039;box_selected&#039;);
	radioHighlight(&#039;trans_type&#039;, &#039;box_selected&#039;);
);
&lt;/code&gt;

My HTML is like this:

&lt;code&gt;
 By Credit/Debit Card
 By PayPal
 By Bank Transfer
 By Cheque
&lt;/code&gt;

Thanks again
Ziad</description>
		<content:encoded><![CDATA[<p>Great tip Barry, thanks!</p>
<p>I was trying to do it the other way around but ran into some problem. The code works but only on the last radio button set. Not sure why:</p>
<p><code><br />
$(<br />
	function radioHighlight(radioName, className) {<br />
		radioNameSelector = "input[name='" + radioName + "']";<br />
		$(radioNameSelector).click(function() {<br />
			$(radioNameSelector).parent().removeClass(className);<br />
			$(radioNameSelector + ':checked').parent().addClass(className);<br />
		});<br />
	}	</p>
<p>	radioHighlight('beneficiary', 'box_selected');<br />
	radioHighlight('trans_type', 'box_selected');<br />
);<br />
</code></p>
<p>My HTML is like this:</p>
<p><code><br />
 By Credit/Debit Card<br />
 By PayPal<br />
 By Bank Transfer<br />
 By Cheque<br />
</code></p>
<p>Thanks again<br />
Ziad</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://dev-tips.com/featured/jquery-tip-how-to-select-radiocheckbox-input-on-click#comment-1709</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Tue, 09 Mar 2010 23:48:42 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=80#comment-1709</guid>
		<description>A problem:

Say you have two radio buttons (yes/no) and you want to trigger a $(&quot;#foo&quot;).show(); event from one of them, but not the other, such that if someone clicks the &#039;yes&#039; option, you get a div to appear, click &#039;no&#039; and nothing appears to happen.</description>
		<content:encoded><![CDATA[<p>A problem:</p>
<p>Say you have two radio buttons (yes/no) and you want to trigger a $(&#8220;#foo&#8221;).show(); event from one of them, but not the other, such that if someone clicks the &#8216;yes&#8217; option, you get a div to appear, click &#8216;no&#8217; and nothing appears to happen.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry Roodt</title>
		<link>http://dev-tips.com/featured/jquery-tip-how-to-select-radiocheckbox-input-on-click#comment-1231</link>
		<dc:creator>Barry Roodt</dc:creator>
		<pubDate>Sun, 20 Dec 2009 19:25:51 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=80#comment-1231</guid>
		<description>Hi Paul,

Aah ok i see now. .children() returns an array of elements. Well spotted, and thanks for the fix.</description>
		<content:encoded><![CDATA[<p>Hi Paul,</p>
<p>Aah ok i see now. .children() returns an array of elements. Well spotted, and thanks for the fix.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://dev-tips.com/featured/jquery-tip-how-to-select-radiocheckbox-input-on-click#comment-1221</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Sat, 19 Dec 2009 22:35:16 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=80#comment-1221</guid>
		<description>I was experiencing the &#039;too much recursion&#039; error in FF 3.5.6. It seems the click() gets evaluated on the &#039;li&#039; element rather than the included radio button.

Changing the third line to
&lt;code&gt;$(this).addClass(&#039;selected&#039;).children(&quot;input[@type=radio]&quot;)[0].click();&lt;/code&gt;
did the trick, at least in FF.

And thanks for your nice article, Barry!</description>
		<content:encoded><![CDATA[<p>I was experiencing the &#8216;too much recursion&#8217; error in FF 3.5.6. It seems the click() gets evaluated on the &#8216;li&#8217; element rather than the included radio button.</p>
<p>Changing the third line to<br />
<code>$(this).addClass('selected').children("input[@type=radio]")[0].click();</code><br />
did the trick, at least in FF.</p>
<p>And thanks for your nice article, Barry!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: indialike</title>
		<link>http://dev-tips.com/featured/jquery-tip-how-to-select-radiocheckbox-input-on-click#comment-1211</link>
		<dc:creator>indialike</dc:creator>
		<pubDate>Wed, 16 Dec 2009 08:11:54 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=80#comment-1211</guid>
		<description>Very nice and useful tutorials to web designers,
Thanks for posting.</description>
		<content:encoded><![CDATA[<p>Very nice and useful tutorials to web designers,<br />
Thanks for posting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry Roodt</title>
		<link>http://dev-tips.com/featured/jquery-tip-how-to-select-radiocheckbox-input-on-click#comment-1109</link>
		<dc:creator>Barry Roodt</dc:creator>
		<pubDate>Fri, 27 Nov 2009 04:41:04 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=80#comment-1109</guid>
		<description>I&#039;m not sure that I&#039;m with you, there&#039;s no recursion there.

That piece of code is listening for a click on an LI element. The &quot;.children(&quot;input[type=radio]&quot;).click()&quot; bit is firing a click event on the radio input element directly, not the LI - so no recursion.

Am I missing something ? Do you have an example perhaps.. might make more sense to me then.

Thanks</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure that I&#8217;m with you, there&#8217;s no recursion there.</p>
<p>That piece of code is listening for a click on an LI element. The &#8220;.children(&#8220;input[type=radio]&#8220;).click()&#8221; bit is firing a click event on the radio input element directly, not the LI &#8211; so no recursion.</p>
<p>Am I missing something ? Do you have an example perhaps.. might make more sense to me then.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

