Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Display textarea when radio button is selected

Posted on 2012-03-12
3
Medium Priority
?
551 Views
Last Modified: 2012-03-12
Hi Experts,

I need a simple script doing this:
I have 2 radio buttons, by default first button is selected and first textarea is shown, but when I select second button, I want to display another textarea (replacing previous one).
In other words: Two radio buttons and two textareas, first radio button is linked to first textarea, second button to second textarea. I want to switch between those textareas (show/hide) when selecting radio buttons. I hope it's clear :-) Thanks.
0
Comment
Question by:Zado
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 13

Assisted Solution

by:ansudhindra
ansudhindra earned 1000 total points
ID: 37710080
0
 
LVL 35

Accepted Solution

by:
YZlat earned 1000 total points
ID: 37710098
try something like that:

$(document).ready(function () {
		        toggleRadioButtons();

		    });



		    function toggleRadioButtons() {
			$("#rb").click(function() {     
				var value = $(this).val();
				if (value=="r1") {

		                	$('#area2').hide();
					$('#area1').show();
				}else{
					$('#area1').hide();
					$('#area2').show();
				}
			}); 
			
 

		    }

Open in new window

0
 
LVL 8

Author Closing Comment

by:Zado
ID: 37710469
Thanks, it works.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question