Added buttons for known types. #5

Merged
snoopy merged 2 commits from type-buttons into main 2024-05-07 20:31:09 +02:00
Showing only changes of commit c9cda14f38 - Show all commits

View file

@ -67,19 +67,19 @@ function knownTypes() {
}
// Get location in document.
let known_types = document.getElementById('knowntypes');
const known_types = document.getElementById('knowntypes');
known_types.textContent = `Known types: `;
// Create a button for every known type.
for (let label of Object.keys(map).sort()) {
btn = document.createElement('button');
btn.setAttribute('type', 'button');
btn.textContent = label;
btn.addEventListener('click', function() {
document.getElementById('type').value = label;
});
btn = document.createElement('button');
btn.setAttribute('type', 'button');
btn.textContent = label;
btn.addEventListener('click', function() {
document.getElementById('type').value = label;
});
known_types.appendChild(btn);
known_types.appendChild(btn);
}
}