Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Custom Drop down with check boxes Reply To: Custom Drop down with check boxes

#204131
sidh2015
Participant
<label class=”control-label” for=”FIPS”>County</label> @Html.DropDownListFor(Model => Model.CountyId, new SelectList(counties, “Key”, “Value”), “”, new { @class = “form-control”, id = “countyValue” })

var initiateDropDownListShortAndLong2 = function (ddlShort) {

$(ddlShort).on({
    change: function (event) {

        $(ddlShort + ' option:first-child ').html($(ddlShort).val());
        $(ddlShort + ' option:first-child ').val($(ddlShort).val());

        $(ddlShort).prop('selectedIndex', 0);

    }
});

};

$(document).ready(function () {
initiateDropDownListShortAndLong2(‘#countyValue’);
});