Skip to content
Loading
Hide And Show in MVC  
Script
 
  1. $(document).ready(function(){  
  2.     $('#name').click(function() {  
  3.       $('.name').show();  
  4.         $('.id').hide();  
  5.          $('.phno').hide();  
  6.      });  
  7.     $('#id').click(function() {  
  8.            $('.name').hide();  
  9.         $('.id').show();  
  10.          $('.phno').hide();  
  11.      });  
  12.    $('#phno').click(function() {  
  13.          $('.name').hide();  
  14.         $('.id').hide();  
  15.          $('.phno').show();  
  16.     });  
  17. });  
I hope its helpful to you.
 
+1
  • Tq so much for ur effort and help...Archana devi
    0
  • Thanks for ur effort sivakumar koneti.
    what i need is i have three raddiobutton(id,name,mobile).
    if i click the id radiobutton it will show the id textbox and if i click the name it will show the name only not the id and mobile.and if i search the already existing id in the search box it will show the id.
    thanks....
    0
  • Sivakumar Koneti
    1. "text/javascript">  
    2. function yesnoCheck() {  
    3. if (document.getElementById('yesCheck').checked) {  
    4. document.getElementById('ifYes').style.display = 'block';  
    5. }  
    6. else document.getElementById('ifYes').style.display = 'none';  
    7. }  
    8.   
    9. Yes "radio" onclick="javascript:yesnoCheck();" name="yesno" id="yesCheck"> No "radio" onclick="javascript:yesnoCheck();" name="yesno" id="noCheck">
        
    10. "ifYes" style="display:none">  
    11. If yes, explain: 'text' id='yes' name='yes'>
        
    12. What can we do to accommodate you? 'text' id='acc' name='acc'>  
      
  • other 3'text' id='other3' name='other3'>
      
  • other 4'text' id='other4' name='other4'>
      
  • http://jsfiddle.net/QAaHP/16/
     
    Another example:
     
    see this link your expected output is available
     
    http://jsfiddle.net/sfw0g2a7/1/
     
    reference
     
    https://stackoverflow.com/questions/33081297/hiding-divs-based-on-radio-button-selection-using-jquery
    0