为什么我的控制台记录$(this).data?当我控制台登录变量我得到未定义。
我需要访问chartType
沿着与代码移动:
if ($(this).hasClass("points")){
chartType = $(this).data('chart-type');
console.log($(this));
console.log(chartType);
}
下面有什么,它记录 (堆栈溢出不会让我把什么安慰的第一线,但它的存在)
undefined
这是怎么回事? –
可能不确定你的意思。但它在点击功能中发生。它将在控制台中输出未定义的内容。对不起,如果这不是你所需要的。 –