You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
639 B
HTML

<form action="#" onsubmit="updateLabel(event)">
<input type="text" name="label" onkeyup="updateLabel(event)" value="{{ label }}" id="label-input-{{ address }}" onfocusout="updateLabel(event)">
</form>
<script>
function updateLabel(e) {
e.preventDefault();
if (e.keyCode === 13) {
htmx.ajax('GET', `/wallet/{{ address }}/label/${e.target.value}`, '#show_wallets');
} else if (e.keyCode === 27 || e.type == "focusout") {
htmx.ajax('GET', '{{ url_for("htmx.show_wallets") }}', '#show_wallets');
}
}
document.getElementById('label-input-{{ address }}').focus();
</script>