$(".displayAlert").click(function() { alert("ボタンをクリックしました!"); }); <button class="displayAlert">警告を表示する</button>