JS Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined

Error message:

Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined

How to solve this error:

http://stackoverflow.com/questions/23723005/uncaught-typeerror-cannot-read-property-tolowercase-of-undefined

The object does not have the correct.

incorrect:

$("#type").change(function(){
    if($(this).val()==''){
        return;
    }
    var choose= new Array();
    $("input[name='choose[]']:checkbox").each(function(){
        if($(this).prop("checked") == true){
            choose.push($(this).val());
        }
    });
    if(choose == ''){
        layer.msg("No channel selected",{icon:2,time:2000});
        return ;
    }
    layer.confirm('Sure you want to add the selected channel to this model?', {icon: 3, title:'tips'}, function(index){
        $.ajax({type:"post",timeout:"<?php echo TIMEOUT;?>",url:"<?php echo base_url('channel/defchanneladd');?>",
            data:{choose:choose,tvmodel_id:$("#this").val()},success:function(data){
            var obj = JSON.parse(data);
            layer.msg(obj.msg, {icon: obj.code,time:1000},function(){
                if(obj.code == '1'){
                    window.location.reload();
                }
            });
        }});

    });


});

This object in the image above has changed. Pay attention to this

Change this to # type, that is, the select tag

Similar Posts: