Hello,
I am working with a peice of Javascript I found online. This code will search, find and highlight the text when it is found. The problem is, you have to keep clicking SEARCH to find all of the text. I am fairly new to Javascript and can’t figure out what I need to add (or remove) from this script to get it to search, highlight and find ALL of the matching text on the page.
Any help would be great.
Thanks!
CODE:
[code]
<!–BEGIN SEARCH BOX –>
<div class=”search_box”>
<form action=”” id=”form2″>
<div>
<input type=”text” id=”search”>
<input type=”button” id=”submit_form” onclick=”checkInput()” value=”Submit”>
</div>
</form>
</div>
<!–END SEARCH BOX –>
<script>
function checkInput() {
var query = document.getElementById(‘search’).value;
window.find(query);
return true;
}
</script>