Click Issue with input[type=radio] in label tag

Viewed 27

When I perform JQuery click function .click() on .option, it returns result two times. I would like to show it only one time. Check console log for instance.

$(".option").click(function() {
     console.log($(this).attr("class"));
    });
.option {
height :20px;
background:gray;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="option">
  <label for="opt-1"><input type="radio" name="option-name" id="opt-1"> Walk the dog</label>
 </div>

0 Answers
Related