Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript TypeError:$(…)。属性(…)未定义_Javascript_Jquery - Fatal编程技术网

Javascript TypeError:$(…)。属性(…)未定义

Javascript TypeError:$(…)。属性(…)未定义,javascript,jquery,Javascript,Jquery,引用已发布的重复链接: 从jQuery1.6开始,.attr()方法为尚未设置的属性返回undefined 我猜您正在搜索的属性没有设置在 您正在其上搜索的元素。因此,.replace失败 因为undefined没有替换方法。你需要做出决定 当然,首先它不是未定义的 $('.weight').live('input',function() { var t = $(this).attr('id').replace('weight-',''); var tabl

引用已发布的重复链接:

从jQuery1.6开始,.attr()方法为尚未设置的属性返回undefined

我猜您正在搜索的属性没有设置在 您正在其上搜索的元素。因此,.replace失败 因为undefined没有替换方法。你需要做出决定 当然,首先它不是未定义的

$('.weight').live('input',function() {
        var t = $(this).attr('id').replace('weight-',''); 

        var table_name = $('#table_name-'+t+' option:selected').val();

        var quality_color_value = parseFloat($('#quality-color-'+t+' option:selected').attr('data-id').split('\`')[0]);

        var diamond_weight = parseFloat($('#quality-color-'+t+' option:selected').attr('data-id').split('\`')[1]);

        var diamond_pcs = parseFloat($('#diamond-pcs-'+t).val()); 

        if(table_name == 1){ 
           var diamond_weight = parseFloat($('#weight-'+t).val()); 
        }

        if(table_name == 2){
            $('#weight-'+t).val(diamond_weight);
        } 

    });        
对下一个区域中的id也执行此操作


请不要复制其他答案的内容,特别是如果该问题已作为重复问题投票结束,请不要复制。如果您甚至没有提出任何问题,您希望有人如何帮助您?
var current = $(this).attr('rel');
current = current ? current.replace('aboutitemremove_', '') : "";