JSFiddle - React, Tailwind, and code Playground
HTML
<a href='#' id='1'>Click</a> <a href='#' id='2'>Click </a>
JavaScript
$('a').click(function() {
alert('ID: '+$(this).next().attr('id'));
});
<a href='#' id='1'>Click</a> <a href='#' id='2'>Click </a>
$('a').click(function() {
alert('ID: '+$(this).next().attr('id'));
});