Javascript stops working on DropDownList in ASP.NET MVC 5

I’ve got four (4) DropDownList controls that determine what data is shown on a form:

<table style="width: 100%">
    <tr>
        <th style="min-width: fit-content;"></th>
        <th style="width: 20%;">Selection</th>
        <th style="width: 50%;">@Model.SelectionSummary</th>
    </tr>
    <tr>
        <td align="right">By Model/By Month:</td>
        <td>
            @Html.DropDownListFor(m => m.ByModel,
            new List<SelectListItem>() {
                new SelectListItem() { Text = "", Value = "" },
                new SelectListItem() { Text = "By Model", Value = "Model" },
                new SelectListItem() { Text = "By Month", Value = "Month" }
            }, new { @onchange = "updateForm('1')" })
        </td>
        <td>@Model.ByModel</td>
    </tr>
    <tr>
        <td align="right">By Region/By Dealer/ All Regions:</td>
        <td>
            @Html.DropDownListFor(
            m => m.ByRegion,
            new List<SelectListItem>() {
                    new SelectListItem() { Text = "", Value = "" },
                    new SelectListItem() { Text = "By Region", Value = "Region" },
                    new SelectListItem() { Text = "By Dealer", Value = "Dealer" },
                    new SelectListItem() { Text = "All Regions", Value = "All" }
            },
            new { @id = "ByRegion", @onchange = "updateForm('2')" })
        </td>
        <td>@Model.ByRegion</td>
    </tr>
    <tr>
        <td align="right">Region:</td>
        <td>
            @Html.DropDownListFor(
            m => m.Region,
            Model.Regions,
            new { @onchange = "updateForm('3')" }
            )
        </td>
        <td>@Model.Region</td>
    </tr>
    <tr>
        <td align="right">Dealership:</td>
        <td>
            @Html.DropDownListFor(
            m => m.DealerID,
            Model.Dealerships,
            new { @id = "DealerID", @onchange = "updateForm('4')" }
            )
        </td>
        <td>@Model.Dealership</td>
    </tr>
    <tr>
        <td></td>
        <td><input type="submit" value="Submit" class="submit" onclick="showLoading()" /></td>
        <td>Report for: @($"{DateTime.Now}")</td>
    </tr>
</table>

Whenever an item changes in the first “By Model/By Month” DropDownList, the other three (3) lists below it are cleared.

Whenever an item changes in the second “By Region/By Dealer/ All Regions” DropDownList, all of the controls below it are cleared.

The Javascript for that is here:

const updateForm = (changeElement) => {
    let byModel = document.getElementById("ByModel");
    let byRegion = document.getElementById("ByRegion");
    let region = document.getElementById("Region");
    let dealership = document.getElementById("DealerID");
    let currentDealership = "@Model.DealerID";
    window.byModel = byModel;
    window.byRegion = byRegion;
    window.region = region;
    window.dealership = dealership;
    window.currentDealership = currentDealership;

    if (changeElement === null) {
        byModel.value = '';
        byRegion.value = '';
        region.value = '';
        dealership.value = '';
    }

    if (changeElement === '1') {
        byRegion.value = '';
        region.value = '';
        dealership.value = '';
    }
    //if All Regions is selected submit the form - previous functionality
    if (changeElement === '2') {
        if ((byRegion.value === 'All') && (0 < byModel.value.length)) {
            region.innerHTML = "";
            $loading.show();
            document.forms[0].submit();
            $loading.hide();
        }
    }

    //Removes dealership value when region is changed, used in logic below
    if (changeElement === '3') {
        dealership.value = "";
        $.get("@Url.Action("GetDealers", "Admin")?region=");
    }
    //Removes dealer list if ByRegion is anything other than By Dealer and dealership is not blank
    //This is used for when the form submits to refresh the list without needing to interact with the dropdowns
    if (byRegion.value !== "Dealer" && dealership.value.length > 0) {
        dealership.innerHTML = "";
    }
    //Checks that region has a value and dealership does not (because this function is run on page load/refresh)
    //Pulls in dealer values
    if (0 < region.value.length && byRegion.value === "Dealer" && dealership.value.length < 1) {
        getDealers(region);
    }
    if ((changeElement != '4') && (0 < currentDealership.length)) {
        setTimeout(() => {
            dealership.value = currentDealership;
        }, 1000);
    }
}

window.onload = function refreshForm() {
    updateForm();
}

The form works fine until it is submitted. After the data returns, the Javascript no longer fires whenever the DropDownLists are changed.

Why does the Javascript stop working after data is returned?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật