Aviary only on specific status
This commit is contained in:
parent
41d60eaee8
commit
e38aacafbe
6 changed files with 39 additions and 21 deletions
21
static/js/bird.js
Normal file
21
static/js/bird.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
function showHideAviary() {
|
||||
let statusField = document.getElementById("id_status");
|
||||
let aviaryField = document.getElementById("div_id_aviary");
|
||||
let statusText = statusField.options[statusField.selectedIndex].text;
|
||||
|
||||
if (statusText == 'In Auswilderung') {
|
||||
aviaryField.hidden = false
|
||||
} else {
|
||||
aviaryField.hidden = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Load function on windows load.
|
||||
(showHideAviary)();
|
||||
|
||||
// Load function on change.
|
||||
document.getElementById("id_status").addEventListener("change", (event) => {
|
||||
showHideAviary()
|
||||
});
|
|
@ -1,6 +0,0 @@
|
|||
let sel = document.getElementById("id_status");
|
||||
let text = sel.options[sel.selectedIndex].text;
|
||||
|
||||
if (text === 'In Auswilderung') {
|
||||
console.log("Yes");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue