SyntaxFix
Write A Post
Hire A Developer
Questions
You can also use insertAdjacentHTML function:
insertAdjacentHTML
const select = document.querySelector('select') const value = 'bmw' const label = 'BMW' select.insertAdjacentHTML('beforeend', ` <option value="${value}">${label}</option> `)