is not checking me if a button is checked or not

0

if (document.getElementById("circular_select").checked === true) {
  piechart();
}
if (document.getElementById("barras_select").checked === true) {
  alert("You have selected Option 1");
}
<div class="btn-group custom-btn-group  " data-toggle="buttons" >
  <label class="btn btn-default active">
    <img src="img/3d-pie-chart-icon.png" alt=""/>
    <input type="radio" class="form-control" name="feature" value="opt0"  id="circular_select" checked="checked"    />

  </label>
  <label class="btn btn-default ">
    <img src="img/SEO-icon.png" alt=""/>
    <input type="radio" class="form-control"  name="feature" value="opt1" id="barras_select"  />
  </label>
</div> 
    
asked by anonymous 29.10.2015 / 16:27

1 answer

0

If you put a alert() on the first if it will be fired, there must be something wrong with your piechart () function

Example:

if (document.getElementById("circular_select").checked === true) {
  alert('check 1');
}
if (document.getElementById("barras_select").checked === true) {
  alert('check 2');
}
<div class="btn-group custom-btn-group  " data-toggle="buttons">
  <label class="btn btn-default active">
    <img src="img/3d-pie-chart-icon.png" alt="" />
    <input type="radio" class="form-control" name="feature" value="opt0" id="circular_select" checked="checked" />
  </label>
  <label class="btn btn-default ">
    <img src="img/SEO-icon.png" alt="" />
    <input type="radio" class="form-control" name="feature" value="opt1" id="barras_select" />
  </label>
</div>
    
29.10.2015 / 16:34