JQuery find by two attr values

I have table cells with data-position-x and data-position-y attributes with integer values. I want to find one specific cell with x and y values. Is this possible in jQuery? At the moment, I can’t understand how I can pass two predicates to build $('[data-position-x="0"]');

+6
source share
2 answers

multiple attribute selector is what you are looking for:

 $('[data-position-x="0"][data-position-y="0"]'); 
+8
source

Just execute 2 (or more) [] blocks to search for multiple attributes:

 $('[data-position-x="0"][data-position-y="0"]'); 
+8
source

Source: https://habr.com/ru/post/920071/


All Articles