Find elements by custom data attribute value

前端 未结 3 460
故里飘歌
故里飘歌 2020-12-22 11:16

I was wondering if there\'s a way to select an item (div,span,whatever..) using javascript with jQuery (+ jQuery UI lib) based on its data attribute value. For example, let\

3条回答
  •  醉话见心
    2020-12-22 11:42

    Try this

        $("div.b").filter(function() { 
              return $.data(this, "myKey") == 1234; 
        });
    

提交回复
热议问题