On selecting Radio button then desire checkbox should be select

exposing additional form fields via checked radio buttons
html radio button checked
html radio button default none selected
radio button checked show div css
radio button javascript
radio button css
show div on radio button select javascript
php radio button checked or unchecked

I want to make jQuery validation on radio button but I am unable to make working code .

I made this code but by this only one radio button is working.

$(document).ready(function() {
  $('#radio1').change(function() {
    $("#lhr1").prop("checked", true)
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container">
      <h2 align="center"><b><i>Form Validation Assignment</i></b></h2>
      <form id="vald" class="form-horizontal" action="">
        </div>
        <div class="form-check form-check-inline" id="radio1">
                <label class="control-label col-sm-2" for="name">Gender</label>
                <div class="container">
                        <label class="radio-inline">
                                <input type="radio" name="optradio" id="male">Male
                              </label>
                              <label class="radio-inline">
                        <input type="radio" name="optradio" id="female">Female
                              </label>
                      </div>
        </div>
    
        <input type="checkbox" name="lhr" value="lhr" id="lhr1"> You can go Lahore<br>
    <input type="checkbox" name="mtn" value="mtn" id="mtn1">You can go Multan<br>
        <div class="form-group">        
          <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-default" id="add">Submit</button>
          </div>
        </div>
      </form>
    </div>

It'll be easier to use data attribute for male and female inputs like this ..

<input type="radio" name="optradio" id="female" data-check-id="mtn1">

$(document).ready(function() {
  $('[name="optradio"]').change(function() {
    $('#lhr1 , #mtn1').prop('checked' , false);
    $('#'+$(this).attr('data-check-id')).prop('checked' , true);
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container">
      <h2 align="center"><b><i>Form Validation Assignment</i></b></h2>
      <form id="vald" class="form-horizontal" action="">
        </div>
        <div class="form-check form-check-inline" id="radio1">
                <label class="control-label col-sm-2" for="name">Gender</label>
                <div class="container">
                        <label class="radio-inline">
                                <input type="radio" name="optradio" id="male" data-check-id="lhr1">Male
                              </label>
                              <label class="radio-inline">
                        <input type="radio" name="optradio" id="female" data-check-id="mtn1">Female
                              </label>
                      </div>
        </div>
    
        <input type="checkbox" name="lhr" value="lhr" id="lhr1"> You can go Lahore<br>
    <input type="checkbox" name="mtn" value="mtn" id="mtn1">You can go Multan<br>
        <div class="form-group">        
          <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-default" id="add">Submit</button>
          </div>
        </div>
      </form>
    </div>

Exposing Additional Form Fields via Checked Radio Buttons, Either a checkbox or a radio button can be “checked” (:checked). The div we're going to reveal has to be after it, and a sibling element (within the same parent). When should you use radio buttons or checkboxes? This relies entirely on what question you are asking. If you want your users to select multiple options, use checkboxes. If you want your users to select only one option, use radio buttons (or another alternative). When to use a radio button. I have four rules about when, or when not to, use radio buttons.


This should do the job

$(document).ready(function(){
    $('#male').click(function(){        
        $('#mtn1').prop("checked", $(this).is(':checked'));
    });

    $('#female').click(function(){      
        $('#lhr1').prop("checked", $(this).is(':checked'));     
    });
});

Getting StartED Building Websites, Radio buttons, on the other hand, only allow a single selection between various You should also remember to wrap checkboxes and radio buttons with desire from a list; radio boxes allow visitors to choose from one of two or more options. There are standard keyboard shortcuts to select and deselect checkboxes and radio buttons. After tabbing to a radio button field, the arrow keys can be used to make the selection. The spacebar can also be used for this but it has limited functionality in that it cannot be used to make a different selection. The arrow keys won't work with checkboxes. The spacebar is used to select and deselect those.


To just (slightly) modify your code, this should also work.

$(document).ready(function() {
  $('#radio1').change(function() {
    // Get the currently selected gender
    let gender = $("input[name=optradio]:checked").attr("id");

    // Check checkboxes based on gender
    $("#lhr1").prop("checked", gender === "male")
    $("#mtn1").prop("checked", gender === "female")

  });
});

Mastering Access Made Easy: Versions 2007 Through 97, Next, select which fields from the selected query or table you want to display in the report list and then clicking the “>” button to move them to the “Selected Fields:” list. You can also check the checkbox for “Calculate percent of total for sums,” if you Next, select the desired report layout by selecting the option button that  The radio button is presented as a small circle on the screen. It also has two states, and when selected, the circle is filled with a solid dot. In contrast to checkbox groups, radio button groups behave as a single control and limit the user’s choice to just one option from the range provided.


IBM SPSS Statistics 23 Step by Step: A Simple Guide and Reference, Check boxes Radio buttons key, then press the underlined letter on the keyboard to select that option. For instance, to select edit, press the alT key and then the letter e. The menu There are many more keyboard operations but this should give you a start. Selecting With check boxes you simply select those you desire​. Radio buttons are similar to checkboxes, except that only one radio button in a group can be selected at any one time. (As with checkboxes, a radio button group is a collection of radio buttons with the same name attribute.) Radio buttons are useful for getting a user to pick from a choice of options. (If you have a lot of options, consider using a menu instead.) The radio button tag has the same attributes as the checkbox element:


Radio Buttons: Always Select One?, People sometimes confuse radio buttons and checkboxes, but checkboxes are the GUI widget to employ when users can select any number of the 4 radio buttons with option 1 selected, options 2,3, and 4 not As for the business needs and desires, discuss with the powers that be what the business  The code below will click on Facebook's "Keep me logged in" check box twice and then output the result as TRUE when it is toggled on, and FALSE if it is toggled off. isSelected() method is used to know whether the Checkbox is toggled on or off.


Checkboxes vs. Radio Buttons, A radio button should be a small circle that has a solid circle inside it when selected. Visually present groups of choices as groups, and clearly  If you are using RadioButtons in RadioGroup then RadioButtons should be direct child of RadioGroup. I check my first condition and it was correct but still all radio buttons are getting selected and when gives ids and run project, it automatically solved my problem.