JSFiddle - React, Tailwind, and code Playground

HTML

<h1>123</h1>
    <h1>456</h1>
    <h1>789</h1>

JavaScript

$(document).ready(function() {

    var changeText1 = '123';
    var changeText2 = '456';
    var text = $(h1).text();

    if (text == changeText) {
        $(this).text('hi');
    } else if (text == changeText2 ) {
        $(this).text('hi2');
    }

});