This should work:
var anchors = document.getElementsByClassName("awsui_tabs-content");
var count = 0;
Array.from(anchors).forEach(function (anchor) {
anchor.addEventListener("click", function (event) {
console.log("Clicked! count: " + ++count);
});
});
UPDATE
This was my test:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div id="app">
<a href="#" class="my_anchor">anchor 1</a>
<a href="#" class="my_anchor">anchor 2</a>
<a href="#" class="my_anchor">anchor 3</a>
<a href="#" class="my_anchor">anchor 4</a>
<a href="#" class="my_anchor">anchor 5</a>
<a href="#" class="my_anchor">anchor 6</a>
<a href="#" class="my_anchor">anchor 7</a>
<a href="#" class="my_anchor">anchor 8</a>
</div>
</body>
<script>
var anchors = document.getElementsByClassName("my_anchor");
var count = 0;
Array.from(anchors).forEach(function (anchor) {
anchor.addEventListener("click", function (obj) {
console.log("Clicked! count:" + ++count);
});
});
</script>
</html>
and the console output when I click on anchors:
Clicked! count:1
Clicked! count:2
Clicked! count:3
Clicked! count:4
Clicked! count:5
Clicked! count:6
Clicked! count:7
Clicked! count:8