0
I created a js to display the results as the search and the code works perfectly, as example below.
$(document).ready(function(){
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$(".blocos").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
$('.linhas').remove();
});
});
<script
src="https://code.jquery.com/jquery-3.4.0.js"
integrity="sha256-DYZMCC8HTC+QDr5QNaIcfR7VSPtcISykd+6eSmBW5qo="
crossorigin="anonymous"></script>
<div class="busca"><input id="myInput" placeholder="Filtrar por nome" type="text" /></div>
<p class="blocos"> azul </p>
<p class="blocos"> verde </p>
<p class="blocos"> amarelo </p>
What I need is to display an error message when the user types a term that does not exist in the content inside blocks, if the user types see (it will soon display the green as it exists within the context) but if the user types "veg" it should return an error message). Does anyone know how I could do that?
Thanks man, that’s right, fight!
– Thiago Maia