[jQuery] toggle a div based on clicking a specific radio button

[jQuery] toggle a div based on clicking a specific radio button

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=800093718-21032007><FONT face=Arial
color=#0000ff size=2>Thanks Josh and Brandon!! That did the
trick!</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> discuss-bounces@jquery.com
[mailto:discuss-bounces@jquery.com] <B>On Behalf Of </B>Brandon
Aaron<BR><B>Sent:</B> Wednesday, March 21, 2007 1:11 PM<BR><B>To:</B> jQuery
Discussion.<BR><B>Subject:</B> Re: [jQuery] toggle a div based on clicking a
specific radio button<BR></FONT><BR></DIV>
<DIV></DIV>On 3/21/07, <B class=gmail_sendername>Josh Nathanson</B> <<A
href="mailto:josh@oakcitygraphics.com">josh@oakcitygraphics.com</A>> wrote:
<DIV><SPAN class=gmail_quote></SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV bgcolor="#ffffff">
<DIV><FONT face=Arial size=2>Hi Andy,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>My approach with radio buttons:</FONT></DIV>
<DIV><FONT face=Arial size=2>- Bind a click function to the group</FONT></DIV>
<DIV><FONT face=Arial size=2>- when clicked, check the value - if it's the one
you want, show - otherwise, hide</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>$("input[@name=domainlist]").click(function()
{</FONT></DIV>
<DIV><FONT face=Arial size=2>if(this.value == 'm') {</FONT></DIV>
<DIV><FONT face=Arial size=2>   
$('#manual').show("fast");</FONT></DIV>
<DIV><FONT face=Arial size=2>}<BR>else {</FONT></DIV>
<DIV><FONT face=Arial size=2> $('#manual').hide("fast");</FONT><BR><FONT
face=Arial size=2>}</FONT></DIV></DIV></BLOCKQUOTE>
<DIV><BR><BR>The above could also be written as
this:<BR><BR>$("input[@name=domainlist]").bind('click', function() { <BR> 
  $('#manual)[this.value==m?'show':'hide']('fast');
<BR>});<BR><BR>--<BR>Brandon Aaron<BR></DIV><BR></DIV><BR></BODY></HTML>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/











































    • Topic Participants

    • lists