Kalyani Shevale

Kalyani Shevale

  • NA
  • 3.2k
  • 703.3k

unchecked radio button that time only one textbox invisible

Nov 1 2018 5:00 AM
if checked on radio group button in "other option" that time textbox displayed .then another Question Same proces follewed .after unchecked in "other " option in radio button in one Question that time both textbox are hide...how to solve this problem??
when which Question other option is unchecked that time this only this textbox are hide???
 
  1. foreach (var item in answer)  
  2.                                            {  
  3.                                                class="col-md-12">  
  4.                                                    class="col-md-11 test">  
  5.                                                        @{  
  6.                                                            if (item.AnswerOption.Equals("Other (Please specify)"))  
  7.                                                            {  
  8.                                                                class="radio">  
  9.                                                                    class="col-md-4">  
  10.                                                                        "radio" name="[email protected]" value="@item.Id" id="@item.AnswerOption" class="rdcheck"> @item.AnswerOption  



  11.                                                                    
  12.                                                                
  
  •                                                                  
  •                                                                class="col-md-8">  
  •                                                                    "text" name="[email protected]" placeholder="Other Field" class="radioisother" id="[email protected]">  
  •                                                                  
  •                                                            }  
  •                                                            else  
  •                                                            {  
  •                                                                "radio" name="[email protected]" value="@item.Id" id="@item.AnswerOption" class="radonotext"> @item.AnswerOption  
  •                                                            }  
  •                                                        }  
  •   
  •                                                      
  •                                                  
  •                                                            }  
  •   
     js code
    1. $('.rdcheck').click(function () {  
    2.       
    3.          var value = $('input[name=rdcheck]:checked').val();  
    4.            
    5.          var rd = $(this).next('span').text();  
    6.          var test = "rdother_" + $(this).val();  
    7.          var d = $(this).attr('id');  
    8.            
    9.          if ( d == "Other (Please specify)") {  
    10.              var test = "rdother_" + $(this).val();  
    11.               
    12.              $('#' + test).show();  
    13.          }  
    14.          });  
    15.      $('.radonotext').click(function () {  
    16.          $('.radioisother').hide();  
    17.          var value = $('input[class=radonotext]:checked').val();  
    18.          var d = $(this).attr('id');  
    19.           
    20.           
    21.          if (d != "Other (Please specify)")  
    22.          {  
    23.              var test = "rdother_" + $(this).val();  
    24.              
    25.              $('.' + test).val("");  
    26.              $('.' + test).hide();  
    27.             // $('.radioisother').val("");  
    28.            
    29.          }  
    30.   
    31.   
    32.      });