开发者

Get each selector of a multi selector jQuery object as a string

开发者 https://www.devze.com 2023-04-04 08:06 出处:网络
If I pass a number of selectors to jQuery, how can I differentiate the selector of each of th开发者_运维问答ose selectors as separate strings? For example:

If I pass a number of selectors to jQuery, how can I differentiate the selector of each of th开发者_运维问答ose selectors as separate strings? For example:

$('#selector-a, #selector-b, #selector-c').each(function(){
    console.log( $(this).selector ); // logs an empty string
});


$.each($('#selector-a, #selector-b, #selector-c').selector.split(','),
       function(index, value) {
           console.log(value);
       }
); 
0

精彩评论

暂无评论...
验证码 换一张
取 消