var EntiteGenerale = document.getElementById("TypeEntityId");
var select = document.getElementById("EntityId");
var index;
var Departement = {
1: "Finances et Administration",
2: "Service Logistique Transversale",
3: "Institut de Formation",
4: "Communication, Marketing & Commercial",
5: "Volontariat",
6: "Ressources Humaines",
7: "Service francophone du sang",
8: "Service ECM et DIH",
9: "Service Tracing",
10: "Département Secours"
};
var CentreSecours = {
1: "CG BUTGENBACH BULLINGEN",
2: "CS BLEGNY",
3: "CS BRABANT OUEST",
4: "CS CHARLEROI",
5: "CS HAUTE SENNE",
6: "CS HERSTAL - OUPEYE",
7: "CS TOURNAI",
8: "CS NAMUR",
9: "CS OTTIGNIES",
10: "CS OUGREE",
11: "CS PHILIPPEVILLE",
12: "CS ROCHEFORT",
13: "CS SPA",
14: "CS HESBAYE-CONDROZ",
15: "CS JODOIGNE",
16: "CS LIEGE",
17: "CS LUXEMBOURG",
18: "CS MONS",
19: "CS MOUSCRON"
};
function DisplayEntiteL() {
EntiteGenerale = parseFloat(EntiteGenerale.value);
if (EntiteGenerale === 2) {
for (index in Departement) {
select.options[select.options.length] = new Option(Departement[index], index);
}
} else if (EntiteGenerale === 3) {
for (index in CentreSecours) {
select.options[select.options.length] = new Option(CentreSecours[index], index);
}
} else {
console.log("rien à afficher");
}
}
input[type='checkbox'] {
-webkit-appearance: none;
-moz-appearance: none;
-o-appearance: none;
border: 1px solid rgba(0, 0, 0, 0.1);
width: 15px;
height: 15px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
input[type='radio'] {
-webkit-appearance: none;
-moz-appearance: none;
-o-appearance: none;
border: 1px solid rgba(0, 0, 0, 0.1);
width: 15px;
height: 15px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
input[type='radio']:checked {
background-color: red;
}
input[type='checkbox']:checked {
background-color: red;
}
input::placeholder {
font-size: 0.7rem;
}
select {
border-radius: 20px;
font-size: 0.8rem;
}
select:focus {
border-color: #ff2400;
outline: 0;
box-shadow: none;
}
<div class="row col-md-12">
<div class="col-md-12">
Votre entité générale :
<select onchange="DisplayEntiteL()" data-val="true" data-val-number="The field TypeEntityId must be a number." data-val-range="The field TypeEntityId must be between 1 and 2147483647." data-val-range-max="2147483647" data-val-range-min="1" data-val-required="Vous devez donner un TYPE d'entité"
id="TypeEntityId" name="TypeEntityId">
&e [...]