Good time! there is such HTML
<div id="pescont"> <div class="personajeinl" id="perc1"onclick="javascript:selectperson ('1');"></div> <div class="hidrad"></div> <div class="personajeinl" id="perc2"onclick="javascript:selectperson ('2');"></div> <div class="hidrad"></div> <div class="personajeinl" id="perc3"onclick="javascript:selectperson ('3');"></div> <div class="hidrad"></div> </div> In the block with id pescont there can be any number of blocks and some of them have the class hidrad or id starting with perc and ending with a digit. The task when clicking on one of the blocks is to hide all the others except the clicked and blocks with the hidrad class. Tried to make such a function but for some reason it does not work.
function selectperson (id) { $('#pescont *[id != "perc'+id+'"] [class != "hidrad"]').hide(); } The figure of the selected block is transferred to it, but apparently I was mistaken somewhere, tell me what is wrong here?