0

Is it possible to bind click event if radio button is disabled? I want to pop up alert message when clicking the disabled button, anybody know how to do that? Thx :)

$("#radioBtn2").click(function() { 
  alert("I'm enabled")
});

$("#radioBtn").click(function() { 
  alert("I'm disabled")
});
#radioBtn #radioBtn2{
  width: 15px;
  height: 15px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<input type="radio" value="0" id="radioBtn" disabled>
<label for="radioBtn"></label>
<input type="radio" value="1" id="radioBtn2">
<label for="radioBtn2"></label>
S.P.
  • 369
  • 6
  • 18
  • As it stands, your two radio buttons are independent and unconnected. Are they supposed to form a single radio group; ie should they be mutually exclusive? If so, then the behaviour you ask for is a little odd given that one button will always become disabled when the other is enabled. Maybe you could explain a bit more about what you are trying to achieve. – Roamer-1888 Jul 26 '17 at 08:04
  • I just fount the solution from the duplicate question, thank you!! :) – S.P. Jul 26 '17 at 08:55

0 Answers0