I want him to return to me what item I clicked, and as a result, displays undefined :

 $('#div_for_img img').click(function(eventObject) { var a = eventObject.shift; alert(a); }); 

PS Which jQuery version is best to use / learn?

    1 answer 1

    The event object has nothing to do with jQuery, to understand it you need to learn pure JS. In this case, you are trying to get a property of an object called shift , but it does not have such a property. So he displays you undefined as a value.

    To get the item you clicked, use the target property.

    Even without jQuery:

     document.getElementById("clickMe").onclick = function(e){ console.log(e.target); } 
     <div id="clickMe">Click Me</div> 

    The only difference is that in jQuery it will work together with IE, while in pure JS you need to do some additional steps. You will learn better on the latest version or on the one for which your materials are written for which you are studying and it is good if they are at least for 2.7 or higher. The main thing that is not for the first, it is already quite old.

    PS Save a reference to the MDN help , it will come in handy again and again.