0
Hello! My name is Caio and I am layman in the JS category, I am still learning.
I have a challenge that is to build a search bar that searches multiple "keywords" in the same bar and returns each respective result of that search at once.
Examples:
Today my bar filters 1 "keyword" at a time:
Exemplo Generalista:
Barra de Pesquisa: João
resultado:
- João da Silva
- João Pereira
Exemplo Minha Situação Real:
Barra de Pesquisa: 0067
- 0067 - Ovo de Codorna
I wish it were something like that:
Exemplo Generalista:
Barra de Pesquisa: João;Rafaela;Caio
resultado:
- Caio Augusto Sitta
- Rafaela Abjur
- Igor Pereira Caio
- João da Silva
- João Pereira
Exemplo Minha Situação Real:
Barra de Pesquisa: 0067;1829;0502
resultado:
- 0067 - Ovo de Codorna
- 1829 - Batata Congelada
- 0502 - Salgadinho Dórime
I looked on the Internet but I couldn’t find anything more common, if someone could give me a light, however small it was I would be very grateful!
edit1: I was asked for some more information, I will pass them below:
(most of these codes were not I who did)
Current search bar code (JS):
$(document).ready(function(){
$("#input_carteira").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#id_carteira li").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
HTML code
<div class="modal-body">
<input class="form-control form-rounded mb-3 mr-3" id="input_carteira"
type="text" placeholder="Procurar.."> {% render_field form.carteira %}
</div>
Thank you very much!
puts in question the code you’ve done so far
– Ricardo Pontual