javascript - If element does not have attributes X and Y? -


I am trying to remove elements that do not have certain features.

I am doing a unique element like this:

  $ ('ul li: no ([data-character =' + chosen + ']]') . Remove ();  

Its work is fine, but I do not know how the element has two or more features. How can I do this?

To remove all the elements that do not have the two attributes you can use

  $ ('ul li: not (delete [data-x =' + 'selectedx +'] [data-y = '+ selecty +']));  

But at this time you can think of the whole design again using an option filter :

  $ ( 'Ul li'). Filter (function () {var data = $ (this) .data (); return! (Data.x == 'avivu' and & amp; yum; y == 'some more');}). Remove ();  

Comments