/**
* Routing page JavaScript functionality
* Handles dynamic keyword input management
*/
function addKeyword() {
const container = document.getElementById('keywords-container');
const newGroup = document.createElement('div');
newGroup.className = 'keyword-input-group flex items-center space-x-2';
newGroup.innerHTML = `
`;
container.appendChild(newGroup);
}
function removeKeyword(button) {
const container = document.getElementById('keywords-container');
const groups = container.querySelectorAll('.keyword-input-group');
// Don't remove if it's the last remaining input
if (groups.length > 1) {
button.parentElement.remove();
} else {
// Clear the input value instead of removing the field
const input = button.parentElement.querySelector('input');
input.value = '';
}
}
// Make functions globally available for onclick handlers
window.addKeyword = addKeyword;
window.removeKeyword = removeKeyword;