Skip to content Skip to sidebar Skip to footer

Hide/display A Input Field Based On Value From Htmlradiobuttonfor And Make It Mandatory If Display

I have a scenario where I have two different div's and the later should disappear based on boolean value from earlier div. if the radiobutton value is true, later div should be a r

Solution 1:

Change it to "True":

$("#employeeNumber").hide();
$("input[name='IsOffered']").on("change", function () {
    if ($(this).val() === "True") {
        $("#employeeNumber").show();
    } else {
        $("#employeeNumber").hide();
    }
});

Because Boolean.ToString() returs "True" instead of "true". So this value is added to the radio that is generated by razor.

Why?

Post a Comment for "Hide/display A Input Field Based On Value From Htmlradiobuttonfor And Make It Mandatory If Display"