Something like this:
var option = document.createElement("option");
option.text = "Text";
option.value = "myvalue";
var select = document.getElementById("id-to-my-select-box");
select.appendChild(option);
More Related Contents:
- jQuery append function is just appending the html but not the classes related to it
- Why are inline event handler attributes a bad idea in modern semantic HTML?
- jQuery/JavaScript collision detection
- Navbar dropdown (collapse) is not working in Bootstrap 5
- What browsers support HTML5 WebSocket API?
- How to validate inputs dynamically created using ng-repeat, ng-show (angular)
- JS function named `animate` doesn’t work in Chrome, but works in IE
- When is NodeList live and when is it static?
- How do I re-trigger a WebKit CSS animation via JavaScript?
- Bootstrap navbar Active State not working
- Change an image with onclick()
- How to make a simple image upload using Javascript/HTML
- Is it possible to programmatically detect size limit for data url?
- Session only cookies with Javascript
- jQuery sort elements using data id
- How to run html file on localhost?
- Cross domain Ajax request from within js file
- Using Matter.js to render to the DOM or React
- Change value of input and submit form in JavaScript
- How to add bootstrap in angular 6 project? [duplicate]
- How to add validation/restrictions for HTML5 date field without jquery/javascript
- Prevent iOS bounce without disabling scroll ability
- Do Shared Web Workers persist across a single page reload, link navigation
- Image Manipulation – add image with corners in exact positions
- Wrapping lists into columns
- Close a SELECT dropdown list programmatically with Javascript/jQuery
- contenteditable div backspace and deleting text node problems
- Removing backslashes from strings in javascript
- HTML5 Notification not working in Mobile Chrome
- Possible to reverse a css animation on class removal?