I have a dynamic search input box and I would like to add a clear contents button but not sure how to do this. I have tried numerous bits of code that I have found on here but none seem to work. Here is the code I have.
$(document).ready(function(){
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#myTable tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
<input id="myInput" type="text" placeholder="Search.." >