Hi,
When i am clicking "Yes"
Radio Button Text Box Should be Enabled and when I'm clicking on Save Button it's showing Validation for text Box .
My Problem is when I'm clocking on "No" Radio Button it's disabling the text box but validation Symbol is not clearing in mvc4
this is my view
<td>Solar Panels</td>
<td>
@Html.RadioButton("rdoSolar_Panels", 1, new { name = "rdoSolarPanels", id = "rdoSolarPanelsY", onclick = "rdoSolarPanels1_Click()", tabindex = "8" })Yes
@Html.RadioButton("rdoSolar_Panels", 2, new { name = "rdoSolarPanels", id = "rdoSolarPanelsN", onclick = "rdoSolarPanels1_Click()", tabindex = "9" })No
@Html.ValidationMessageFor(model => model.rdoSolar_Panels)
</td>
<td>If Yes,Count</td>
<td>
@Html.HiddenFor(model => model.intFacilityID, new { @Value = "6" })
@Html.TextBoxFor(model => model.intSolar_panelsCount, new { maxlength = 4, onkeypress = "return validate(event)", @class = "myclass", tabindex = 10, id = "txtYes", disabled = "disabled" })
@Html.ValidationMessageFor(model => model.intSolar_panelsCount)
</td>
this is java script code
function rdoSolarPanels1_Click() {
if (document.getElementById("rdoSolarPanelsY").checked == true)
$("#txtYes").attr("disabled", false);
else if (document.getElementById("rdoSolarPanelsN").checked == true) {
if(document.getElementById("txtYes").value=="")
{
$("#txtYes.input-validation-error").addClass('input-validation-valid');
$("#txtYes.input-validation-error").removeClass('input-validation-error');
}
$("#txtYes").attr("disabled", true);
$("#txtYes").val(" ");
}
}