A problem of jquery on event Agent

related codes

<a href="javascript:void(0);">11</a>
<a href="javascript:void(0);">22</a>
<a href="javascript:void(0);">33</a>

< / div >

this is how I bind events:

$("div"). On ("click", $("a"), function () {

)
//a

});

Apr.23,2021

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Test</title>
</head>
<body>
  <div>
    <a href="javascript:void(0);">11</a>
    <a href="javascript:void(0);">22</a>
    <a href="javascript:void(0);">33</a>
  </div>
  <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
  <script> 
    $("div").on("click", 'a', function(){
      var currentItem = $(this)
      console.log(currentItem.text())
    });
  </script>
</body>
</html>

$("div"). On ("click", * $("a") * , function () {the $("a") should be changed to'a click "so that the object currently clicked can be obtained through $(this)

.
Menu