here is my radio button:

<label class="col-sm-2 form-control-label">Type</label>
                <div class="col-sm-2">
                    <label class="container">
                        Reward
                        <input name="IsReward" type="radio" asp-for="IsReward" value="True" class="sb-isReward">
                        <span class="checkmark"></span>
                    </label>
                    <span asp-validation-for="IsReward" class="text-danger"></span>
                </div>
                <div class="col-sm-2">
                    <label class="container">
                        Fine
                        <input name="IsReward" type="radio" asp-for="IsReward" value="False" >
                        <span class="checkmark"></span>
                    </label>

                </div>

the textbox I want to show or hide when clicking on "reward" or "fine" option :

                <div class="col-sm-4">
                    <input type="text" asp-for="CostReward" class="form-control sb-digit sb-isRewardTypeDiv">
                    <span asp-validation-for="CostReward" class="text-danger"></span>
                </div>

and finally my jQuery codes that do not work:

$('.sb-isGuilty').on('change', function () {
if (this.checked) {
    $('.sb-isGuiltyTypeDiv').show();
} else {
    $('.sb-isGuiltyTypeDiv').hide();
}
}).trigger('change');

Related posts

Recent Viewed