JSFiddle - React, Tailwind, and code Playground

by Olayinka Otuniyi

HTML

<button id="myButtonId">Find</button>

<div id="myDivId1">
<p>
This is some text in a paragraph.<br>
It has Text placed in my first div.
</p>
</div>

<div id="myDivId2">
<p>
This is some texT in a paragraph.<br>
It has tExt placed in my second div.
</p>
</div>

JavaScript

var myButton = document.getElementById('myButtonId');
	myButton.addEventListener('click', function() {findString ('Text',1,1,0,0,0,0)});
  console.log($("#myDivId1")); 
  
        function findString (str) {
            if (parseInt(navigator.appVersion)<4) return;
            var strFound;
            if (window.find) {
                
                strFound=self.find(str);
                if (!strFound) {
                    strFound=self.find(str,0,1);
                    while (self.find(str,0,1)) continue;
                }
            }
            if (!strFound) console.log ("String '"+str+"' not found!")
                return;
        }