我有一个代码,我在其中迭代元素,我想获得每个元素的 css 样式。我得到这个错误指的是.each:
Uncaught TypeError: Cannot read property 'replace' of undefined
这是示例代码:
$("span").each(function(i,v){
test($(this));
})
function test(element){
console.log(element.css()); //not working
console.log($(element).css()); //not working either
}