Search
 
SCRIPT & CODE EXAMPLE
 

HTML

show and hide divs based on radio button click

<div align="center">
  <input type="radio" name="name_radio1" id="id_radio1" value="value_radio1">Radio1
  <input type="radio" name="name_radio1″ id="id_radio2" value="value_radio2″>Radio2
</div>
 <br />
<div align="center" id="id_data" style="border:5″>
  <div>this is div 1</div>
  <div>this is div 2</div>
  <div>this is div 3</div>
  <div>this is div 4</div>
</div>
<script src="jquery.js"></script>
<script>
 $(document).ready(function() {
 // show the table as soon as the DOM is ready
 $("#id_data").show();
 // shows the table on clicking the noted link
  $("#id_radio1").click(function() {
   $("#id_data").show("slow");
  });
 // hides the table on clicking the noted link
   $("#id_radio2").click(function() {
   $("#id_data").hide("fast");
   });
 });
Comment

show and hide divs based on radio button click

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Untitled Document</title>
        <script type="text/javascript">
            function show(str){
                document.getElementById('sh2').style.display = 'none';
                document.getElementById('sh1').style.display = 'block';
            }
            function show2(sign){
                document.getElementById('sh2').style.display = 'block';
                document.getElementById('sh1').style.display = 'none';
            }
        </script>
    </head>

    <body>
        <p>
            <input type="radio" name="r1" id="e1" onchange="show2()"/> I Am New User   
            <input type="radio" checked="checked" name="r1" onchange="show(this.value)"/> Existing Member
        </p>
        <div id="sh1">Hello There !!</div>
        <p> </p>
        <div id="sh2" style="display:none;">Hey Watz up !!</div>
    </body>
</html>
Comment

PREVIOUS NEXT
Code Example
Html :: simple html report template 
Html :: how to add an input next to each other 
Html :: website in html 
Html :: Chrome Extension change popup 
Html :: vuejs v-on 
Html :: html small text 
Html :: draggable html 
Html :: balise a html 
Html :: color picker js 
Html :: font awesome react color 
Html :: bootstrap login 
Html :: import html display 
Html :: wright word with < in html p tag 
Html :: how to redirect index.html to another folder github 
Html :: preformatted text html 
Html :: html set all text size 
Html :: html audio tag 
Html :: a tag displays below img tag 
Html :: html button click go to section 
Html :: How to create the html link 
Html :: contenteditable attribute 
Html :: fork me github code 
Html :: bootstrap accordion 
Html :: bootstrap sweetalert 
Html :: file input html 
Html :: height 100% tailwind 
Html :: q tag in html 
Html :: Headings 
Html :: tooltip 
Html :: contact us form html send email 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =