最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - MVC page has form. but the control is not hit when debug the jquey code - Stack Overflow

programmeradmin0浏览0评论

MVC page has form. but the control is not hit when debug the jquey code.

the breakpoint is not reaching inside of this code : document.addEventListener("DOMContentLoaded", function () {

The MVC form has below form.

i call the below code one of the javascript method.

document.addEventListener("DOMContentLoaded", function () {
    let form = document.forms["update"];
    if (form) {
        form.addEventListener("submit", function (e) {
            e.preventDefault(); // Stop default form submission
            setTimeout(() => {
                console.log("Submitting form...");
                form.submit(); // Submit after delay
            }, 100);
        });
    } else {
        console.log("Form not found");
    }
});
发布评论

评论列表(0)

  1. 暂无评论