select
Appends one or more <option> elements to a <select> element based on the category passed and an optional placeholder.
Description
This method can programmatically populate a <select> element with <option> elements based on a specified category. An optional can also be passed, appearing as the first <option> element. Otherwise, the default placeholder will be used 'Choose an Option'.
The first parameter should be the CSS Selector for the <select> element (e.g. #chooseCountry), followed by the category of options (e.g. all-countries) you would like to use and lastly, an optional placeholder if you'd like to override the default one (e.g. Choose a Country).
The available categories are specified on this page here.
Parameters
Using This Method
Output
Last updated
Was this helpful?