Hello! There is such a construction:
<div id="wrappep"> <div id="id1"> <a href="#">Π‘ΡΡΠ»ΠΊΠ° 1</a> <a href="#">Π‘ΡΡΠ»ΠΊΠ° 2</a> </div> <div id="id2"> <a href="#">Π‘ΡΡΠ»ΠΊΠ° 3</a> <a href="#">Π‘ΡΡΠ»ΠΊΠ° 4</a> </div> </div> How to use Javascript or jQuery to make it so that when you click on a link, the value of the identifier of the <div> block is written to the variable?
For example, when you click on Π‘ΡΡΠ»ΠΊΠ° 1 , the variable var link assigned the value id1 And when you click on Π‘ΡΡΠ»ΠΊΠ°3 var link will be equal to id2
This must be done using the onclick method.
$('#wrapper').click(function (event) { // ΡΠ·Π½Π°Π΅ΠΌ ΠΏΠΎ ΠΊΠ°ΠΊΠΎΠΌΡ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ Π±ΡΠ» ΠΊΠ»ΠΈΠΊ // ΠΏΡΠΈΡΠ²Π°ΠΈΠ²Π°Π΅ΠΌ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎ id }) Thank!