41 lines
1.1 KiB
JavaScript
Executable File
41 lines
1.1 KiB
JavaScript
Executable File
function FiltreListe(ChampFiltre, FiltreContent, FiltreContentHidden)
|
|
{
|
|
var FiltreAppareil = $("#"+ChampFiltre).val();
|
|
var SelectDestination = $(FiltreContent);
|
|
var arrayShow = [];
|
|
var arrayHide = [];
|
|
|
|
SelectDestination.html('');
|
|
if (FiltreAppareil != "")
|
|
{
|
|
|
|
$(FiltreContentHidden).each(function(){
|
|
|
|
var Trouve = $(this).text().toUpperCase().indexOf(FiltreAppareil.toUpperCase(),0);
|
|
var TrouveBis = $(this).text().toLowerCase().indexOf(FiltreAppareil.toLowerCase(),0);
|
|
//alert(Trouve+" "+$(this).text());
|
|
if(Trouve == -1 && TrouveBis == -1) {
|
|
}
|
|
else {
|
|
SelectDestination.append($(this)[0].outerHTML);
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
else
|
|
{
|
|
$(FiltreContentHidden).each(function(){
|
|
SelectDestination.append($(this)[0].outerHTML);
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
$('body').append( $('#category').clone().hide().attr('name', 'category_hide').attr('id', 'category_hide') );
|
|
$('#filter_sale').keyup(function(){
|
|
FiltreListe('filter_sale', '#category', '#category_hide option');
|
|
});
|
|
|
|
}); |