Below is my jquery code and my ASP>NET mvc razor code. Razor code is for dropdown list. I want to disable the dropdown when the labelCount variables value is 0. The values comes to 0 but the dropdown is not getting disabled.
if (labelCount == 0) {
$("#AndOrSelection").attr("disabled", "disabled");
}
@Html.DropDownList("AndOrSelection", new List<SelectListItem>()
{
new SelectListItem { Text = "And", Value = "And" },
new SelectListItem { Text = "Or", Value = "Or" }
}, "Select criteria")
document.ready()block? Are you getting any errors in the browser console?@Html.DropDownList("AndOrSelection", new SelectList(new List<string>() { "And", "Or" }), "Select criteria")