one 6条回答 盖世英雄少女心 (楼主) 2021-01-12 12:49 Use attribute selector selector[attribute] to get only the elements that have an ID $('.myClass[id]') // Get .myClass elements that have ID attribute In your case: $('.ui-droppable[id]').each(function(){ alert( this.id ); }); jsFiddle demo 0 讨论(0) 查看其它6个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复
Use attribute selector selector[attribute] to get only the elements that have an ID
selector[attribute]
$('.myClass[id]') // Get .myClass elements that have ID attribute
In your case:
$('.ui-droppable[id]').each(function(){ alert( this.id ); });
jsFiddle demo