如果我将多个选择器传递给jQuery,我如何将每个选择器的选择器区分为单独的字符串?例如:
$('#selector-a, #selector-b, #selector-c').each(function(){
console.log( $(this).selector ); // logs an empty string
});
答案 0 :(得分:1)
$.each($('#selector-a, #selector-b, #selector-c').selector.split(','),
function(index, value) {
console.log(value);
}
);