JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#" class="showmsg">dog</a>
<a href="#" class="showmsg">cat</a>
<a href="#" class="showmsg">dinosaur</a>

JavaScript

var sounds = {
    dog: "woof",
    cat: "meow",
    dinosaur: "ROOOOOOOOOOOAAARR!!!",
    etc: "etc"
};
$("a.showmsg").click(function() {
    alert(sounds[$(this).text()] || "");
});