Make route button inactive if no start/destination entered
This commit is contained in:
parent
25777c443f
commit
aaaf26861d
2 changed files with 8 additions and 1 deletions
|
|
@ -581,6 +581,7 @@
|
||||||
routeListEl.innerHTML = "";
|
routeListEl.innerHTML = "";
|
||||||
fromInput.value = "";
|
fromInput.value = "";
|
||||||
toInput.value = "";
|
toInput.value = "";
|
||||||
|
updateRouteBtn();
|
||||||
fetchRepeaters();
|
fetchRepeaters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -862,6 +863,12 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function updateRouteBtn() {
|
||||||
|
routeBtn.disabled = !fromInput.value.trim() || !toInput.value.trim();
|
||||||
|
}
|
||||||
|
fromInput.addEventListener("input", updateRouteBtn);
|
||||||
|
toInput.addEventListener("input", updateRouteBtn);
|
||||||
|
|
||||||
routeBtn.addEventListener("click", findRoute);
|
routeBtn.addEventListener("click", findRoute);
|
||||||
clearBtn.addEventListener("click", clearRoute);
|
clearBtn.addEventListener("click", clearRoute);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
<ul class="autocomplete-list" id="ac-to"></ul>
|
<ul class="autocomplete-list" id="ac-to"></ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="controls-row route-row">
|
<div class="controls-row route-row">
|
||||||
<button id="route-btn">Route</button>
|
<button id="route-btn" disabled>Route</button>
|
||||||
<button id="clear-btn">Clear</button>
|
<button id="clear-btn">Clear</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="controls-row route-row corridor-row" id="corridor-row" style="display:none">
|
<div class="controls-row route-row corridor-row" id="corridor-row" style="display:none">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue