There is an element, for example:
<div category="bedclothes">...</div> and there is a table, for example:
<table> <tr category="everyday">...</tr> <tr category="badclothes everyday">...</tr> <tr>...</tr> </table> How to use jQuery by clicking on a div to hide rows in a table where the category attribute does not match? Sam thought of it this way:
$('div [category]').click(function () { $('tr[category]').css("display","none"); $('tr[category = "'+$(this).attr('category')+'"]').css("display","table-row"); }); But! The whole point is that tr can have several values in the category attribute, separated by a space, and for such cases my code does not work, help to modify it?