JSFiddle - React, Tailwind, and code Playground
HTML
<form action="">
<input type="radio" name="sex" value="male">Male<br>
<input type="radio" name="sex" value="female">Female <br/>
Age: <input type="text" name="age"><br>
</form>
JavaScript
$('input[type=radio]').click(function () {
var $this = $(this);
var sex = $(this).val();
if (sex == "female") {
// disable input
$('input[name=age]').fadeOut(400, function () {
$('input[name=age]').prop('disabled', true);
$(this).css('background', '#c0c0c0').fadeIn("slow", function () {
// Animation complete
});
});
} else {
//enable input
$('input[name=age]').prop('disabled', false);
$('input[name=age]').css('background', '#ffffff');
}
});