par
kevin254kl » 16 nov. 2016, 10:40
Bonjour à tous, pourriez vous m'aider?
J'ai cette fonction qui marche très bien qui permet de rechercher dans mon tableau
Code : Tout sélectionner
// recherche dans le tableau
$("#search").keyup(function(){
_this = this;
$.each($("table tbody tr"), function() {
if($(this).text().toLowerCase().indexOf($(_this).val().toLowerCase()) === -1)
$(this).hide();
else
$(this).show();
});
});
J'aimerais l'adapté pour la recherche dans une seul colonne mais cela ne fonctionne pas, dans ma fonction je récupère bien le champs dans ma liste sélectionné
Code : Tout sélectionner
$("#search_service").on("change", this, function(event) {
_this = this;
$.each($("table tbody tr"), function() {
if($(this).text().toLowerCase().indexOf($(_this).val().toLowerCase()) === -1)
$(this).hide();
else
$(this).show();
});
});
Merci de votre aide.
Bonjour à tous, pourriez vous m'aider?
J'ai cette fonction qui marche très bien qui permet de rechercher dans mon tableau
[code]// recherche dans le tableau
$("#search").keyup(function(){
_this = this;
$.each($("table tbody tr"), function() {
if($(this).text().toLowerCase().indexOf($(_this).val().toLowerCase()) === -1)
$(this).hide();
else
$(this).show();
});
});
[/code]
J'aimerais l'adapté pour la recherche dans une seul colonne mais cela ne fonctionne pas, dans ma fonction je récupère bien le champs dans ma liste sélectionné
[code] $("#search_service").on("change", this, function(event) {
_this = this;
$.each($("table tbody tr"), function() {
if($(this).text().toLowerCase().indexOf($(_this).val().toLowerCase()) === -1)
$(this).hide();
else
$(this).show();
});
}); [/code]
Merci de votre aide.