JSFiddle - React, Tailwind, and code Playground
by Vipin Patil
HTML
<form name="searchBox">
Keyword(s): <input type="text" name="keyword" />
<input type="button" value="Search" onClick="searchFunction()" />
</form>
<div class="searchable" style="display:none">
This is the first software question and answer.</div>
<div class="searchable" style="display:none">
This is the first hardware question and answer.</div>
JavaScript
$(function() {
function searchFunction() {
var searchTerm = document.searchBox.keyword.value;
$(".searchable").each(function(){
//alert(this.class)
$(this).contains('software').show();
// $(this).(":contains('"+searchTerm+"')").show();
});
});
});