jQuery:无法读取未定义的属性“ toLowerCase”

时间:2020-02-16 21:52:49

标签: javascript jquery frontend

我有这样的代码:

$('input[name="switch-tab"]').on('change', function () {
        $.get("/workspace/devicetype", function (type) {
            updateState($(this).val(), type);
        });

        if ($(this).val() === 'tab-1') {
            // here is the logic of deleting some classes and replacing them with others 
        }
        if ($(this).val() === 'tab-2') {
            // here is the logic of deleting some classes and replacing them with others 

        }
        if ($(this).val() === 'tab-3') {
            // here is the logic of deleting some classes and replacing them with others 
        }
        if ($(this).val() === 'tab-4') {
            // here is the logic of deleting some classes and replacing them with others 
        }
    });

function updateState(newState, type) {
        $.post("/workspace/ToTabView", {
            state: newState,
            device: type
        }, function (result) {
            $("#_current_tab").empty();
            $("#_current_tab").append(result);
        });
    }

但是在执行function updateState(newState, type)时,出现此错误

未捕获的TypeError:无法读取未定义的属性“ toLowerCase” 在n.fn.init.val(jquery.min.js:4) 在Object.success(main.js:52) 在我(jquery.min.js:2) 在Object.fireWith [as resolveWith](jquery.min.js:2) 在y(jquery.min.js:4) 在XMLHttpRequest.c(jquery.min.js:4)

告诉我,如何解决这个问题?

0 个答案:

没有答案