Commit | Line | Data |
---|---|---|
80be36aa OL |
1 | |
2 | $(document).ready(function() { | |
bed0c4c9 BS |
3 | $(".selectlist input[type=text]").change(function() { |
4 | var filtre = $(this).val(); | |
5 | var choix = $(this).parent().find("option"); | |
6 | choix.show(); | |
7 | choix.each(function(idx) { | |
6ac4e94c | 8 | if ($(this).html().toLowerCase().indexOf(filtre.toLowerCase()) == -1) $(this).hide(); |
80be36aa | 9 | }); |
bed0c4c9 BS |
10 | }); |
11 | ||
12 | // Set initial value. | |
13 | var current_id_filter = $('#get_post_by_id').val().replace(' ', ''); | |
14 | ||
15 | $('#get_post_by_id').keyup(function(e){ | |
16 | ||
17 | // Get current value. | |
18 | var id_filter = $('#get_post_by_id').val().replace(' ', ''); | |
19 | ||
20 | // If value has changed and is >= 1 in length, then fais-le. | |
21 | if (id_filter.length >= 1 && current_id_filter != id_filter) { | |
22 | ||
23 | // Reset initial value. | |
24 | current_id_filter = id_filter; | |
25 | ||
26 | var found = false; | |
27 | $('#id_postes_rh').children('option').each(function(i, poste_op){ | |
28 | var poste_op = $(poste_op); | |
29 | var tmp_val = 'rh-' + id_filter; | |
30 | // console.log('searching ' + tmp_val + $(poste).attr('value')); | |
31 | if (tmp_val == poste_op.attr('value')) { | |
32 | found = true | |
33 | $('#id_postes_rh').val(tmp_val); | |
34 | return false; | |
35 | } | |
36 | }); | |
37 | // Si on a rien trouvé, reset à la valeur nulle. | |
38 | if (!found) { | |
39 | $('#id_postes_rh').val(''); | |
40 | } | |
41 | } | |
42 | }); | |
43 | }); | |
44 |