JSFiddle - React, Tailwind, and code Playground

HTML

<p id="demo">Click the button to locate where in the string a specifed value occurs.</p>

<input type="button" id="btn" value="click"/>

JavaScript

$('#btn').click(function(){

var str="Hello world, hello to the universe.";
var n=str.indexOf("hello");
alert(n)
});