mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-22 18:56:15 +02:00
cleanup urbanization JS
This commit is contained in:
parent
f7bbed1f03
commit
0986295ab3
2 changed files with 10 additions and 4 deletions
|
@ -1,12 +1,18 @@
|
||||||
|
import { hideElement, showElement } from './helpers.js';
|
||||||
|
|
||||||
function setupUrbanizationToggle(stateTerritoryField) {
|
function setupUrbanizationToggle(stateTerritoryField) {
|
||||||
var urbanizationField = document.getElementById('urbanization-field');
|
let urbanizationField = document.getElementById('urbanization-field');
|
||||||
|
if (!urbanizationField) {
|
||||||
|
console.error("Cannot find expect field: #urbanization-field");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
function toggleUrbanizationField() {
|
function toggleUrbanizationField() {
|
||||||
// Checking specifically for Puerto Rico only
|
// Checking specifically for Puerto Rico only
|
||||||
if (stateTerritoryField.value === 'PR') {
|
if (stateTerritoryField.value === 'PR') {
|
||||||
urbanizationField.style.display = 'block';
|
showElement(urbanizationField);
|
||||||
} else {
|
} else {
|
||||||
urbanizationField.style.display = 'none';
|
hideElement(urbanizationField);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
{% input_with_errors forms.0.zipcode %}
|
{% input_with_errors forms.0.zipcode %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
||||||
<div id="urbanization-field">
|
<div id="urbanization-field" class="display-none">
|
||||||
{% input_with_errors forms.0.urbanization %}
|
{% input_with_errors forms.0.urbanization %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue