Show And Hide Concept in Radio Button - Mostlikers

12 April, 2013

Show And Hide Concept in Radio Button

Show hide concept based on similar div hide and show concept but choose the radio button div will be display function make on jquery. radio button value name call on div just choose radio button value increased div action show/ hide. jquery function called input names to changes the divs values. also having live demo

1.Copy the Script in head tag

<script type="text/javascript" src=""></script>
$(document).ready(function() {
    $("input[name$='cars']").click(function() {
        var test = $(this).val();
        $("#Cars" + test).show();

2.Copy the Below coding in body tag

<div id="myRadioGroup" align="center">
    <p><input type="radio" name="cars" checked="checked" value="2" />Online Payment</p>
    <p><input type="radio" name="cars" value="3" />Door Delivery</p>
<div id="Cars2" class="desc">
       <table width="426" height="127">
           <td>Your Card Number</td>
           <td><label for="card"></label>
           <input type="text" name="card" id="card" size="35" /></td>
           <td><label for="pass"></label>
           <input type="text" name="pass" id="pass"  size="35"/></td>
           <td colspan="2" align="center"><input type="submit" name="submit" id="sub4" value="Submit" /></td>
    <div id="Cars3" class="desc" style="display: none;">
        <tr><td>ADDRESS-1</td><td><textarea name="add1" cols="" rows=""></textarea></td></tr>
           <tr><td>Number</td><td><input type="text" name="phone" placeholder="Enter u r ph number"></td></tr>
                <tr><td colspan="2"><input type="submit" name="submit2" value="submit" /></td></tr>

Live Demo

Online Payment Door Delivery
Your Card Number

1 comment: