Skip to content
Loading
in Jquery checked on checkbox get value in another text  
  •                                                                                                        }  
  •                                                                                                        else  
  •                                                                                                        {  
  •                                                                                                            "checkbox" name="chkbox" @*class="checktextclass"*@ id="@i.Id" value="@i.Id" />@i.AnswerOption  
  •                                                                                                        }  
  •                                                                                                    }  
  •                                                                                                         
  •                                                                                                        }  
  •  
     I have Used below code for Radio button in same functionality
    1. $('.answerDropdown option:selected').each(function (i) {  
    2. var isotherField: $(this).closest('.txtdrop').next().next('.col-md-4').find('input[type=text]').val(),  
    3. });  
    this code is work properly.
    but in Checkbox I below code I try
    1. $.each($("input[name=chkbox]:checked"), function () {  
    2.                 
    3.                    isotherField:$(this).closest('.checkother').next().next('.col-md-8').find('input[type=text]').val(),  
    4.                                    })  
    5.            });  
     please Help me.
    +1
  • Do you have checkbox for all questions ?   -No,I have radio button Question as well as Checkbox Question
    Do you want to point out only one textbox value or all(questions) textbox values ? -Yes but id is different
    When do you want to find the textbox value(means on what action)? If have checked any checkbox that time i want textbox value.
    +1
  • I have multiple Question in each Question has "other filed" that time only one textbox created this textbox is statically defined.
    but I have 2 Question with same textbox class name is same but id is dynamically generated. if I have checked in "other filed " checkbox that time we have enter value in this textbox. how to get two textboxes two different value in jquery.
    +1
  • Sreekanth Reddy
    Please clarify below points :
    Do you have checkbox for all questions ?
    Do you want to point out only one textbox value or all(questions) textbox values ?
    When do you want to find the textbox value(means on what action)?
    +1
  • Suraj Kumar
    You can access textbox in jquery using val() function with their id as shown below 
    1. var valueOfTextBox = $('#YourTextBoxId').val();  
    You can also read textbox value dynamically with id as shown below 
    1. var questionNo = 5;  
    2. var valueOfTextBox = $('#YourTextBoxId' + questionNo).val();    
    Even you can access textbox value in loop also as per requirement.
     
    Hope this will help you.
    +1