JSFiddle - React, Tailwind, and code Playground

by vijayweb

HTML

<a href="#">Hello</a>

<a href="#">Hello 2</a>

<a href="#">Hello 3</a>


<a href="#">Hello 4</a>


<a href="#">Hello 5</a>


<a href="#">Hello 6</a>

<button href="#">Hi there 1</button>

<button href="#">Hi there 2</button>

JavaScript

$("button, a").on( "click", function() {

if($(this).text().includes('Hello 4')){
alert("hi there 4");
} else {
alert($(this).text());
  }
} );