JSFiddle - React, Tailwind, and code Playground

by stevea

HTML

<div>
	<p>
    	Filter: <input id="filter" type="text">
    </p>
</div>

<div class="answer">
      <p>
         <ol start="1">
               <li>Right-click in the canvas to bring up the canvas helper.</li>
               <li>Click in the <b>Background color</b> box to bring up the color picker.</li>
               <li>Select the desired color from the color picker. </li>
         </ol>
      </p>
</div>

JavaScript

$(function(){
    $('input#filter').change(function() {
		var ret;

	   var term = "/" + this.value + "/i";
	   $('.answer').each(function() {
			debugger;
			answerText = $('div.answer')[0].textContent
			ret = answerText.search(/background/i);  // works
            console.log("ret = " + ret);
            ret = answerText.search(term);           // doesn't work
            console.log("ret = " + ret);
		});
	 });
});