JSFiddle - React, Tailwind, and code Playground

HTML

<div id="div_for_img"> 
<img id="img_1" src="images/moto4.jpg" width="200" height="125" alt="Мотоцикл 1" />
<img id="img_2" src="images/moto2.jpg" width="200" height="125" alt="Мотоцикл 2" /> 
<img id="img_3" src="images/moto3.jpg" width="200" height="125" alt="Мотоцикл 3" />
<img id="img_4" src="images/moto1.jpg" width="200" height="125" alt="Мотоцикл 4" />
</div>

CSS

.active {
    border: 2px blue dotted;
}

JavaScript

var $parent = $('#div_for_img');
$parent.on('click', 'img', function (e) {
    if (e.shiftKey) {
        $(this).addClass('active'); 
    } else {
        $(this).removeClass('active');
    }
});