jQuery Toggle method

The toggle() method toggles between hide() and show() for the selected elements.
 
This method checks the selected elements for visibility. show() is run if an element is hidden. hide() is run if an element is visible – This creates a toggle effect.

Example

<!DOCTYPE html>
<html>
<head>
<title>jQuery Toggle</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$(function() {
    $("[name=toggler]").click(function(){
            $('.toHide').hide();
            $("#block"+$(this).val()).show('slow');
    });
 });
</script>
</head>
<body>
	Do you have any criminal convictions :
	<label> <input id="rdb1" type="radio" name="toggler" value="1" /> Yes
	</label>
	<label> <input id="rdb2" type="radio" name="toggler" value="2" /> No
	</label>
	<div id="block1" class="toHide"
		style="display: none; background-color: #FDD5CC; width: 228px;">
		Please Specify
		<form action="nextPage.php">
			<textarea rows="4" cols="25">
			</textarea>
		</form>
	</div>
	<div id="block2" class="toHide"
		style="display: none; background-color: #C1F2C5; width: 200px;">
		Please move on
	</div>
		
</body>
</html>