how to check if div has id or not?

后端 未结 6 578
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

提交回复
热议问题