I have the following HTML element:
Annual Leave&l
You can use this function:
selectElement('leaveCode', '11') function selectElement(id, valueToSelect) { let element = document.getElementById(id); element.value = valueToSelect; }