Skip to content

apkgap/Dropdown-Select-from-json-by-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dropdown-Select-from-json-by-js

A simple JavaScript project that demonstrates how to populate a dropdown (select) element with data fetched from a JSON API. This project also includes an example of integrating the Select2 library for enhanced dropdown UI.

Features

  • Fetches vehicle types from a JSON API endpoint
  • Populates a select element dynamically
  • Sorts options alphabetically (case-insensitive)
  • Supports Select2 for better UX (optional)
  • Error handling for failed API requests

Usage

  1. Clone or download this repository.
  2. Open index.html in your browser.
  3. Make sure your API endpoint is accessible and returns the expected JSON format.

Files

  • index.html – Main HTML file
  • dropdown.js – Basic dropdown population logic
  • dropdown-select2.js – Dropdown logic with Select2 integration

Requirements

  • Modern browser with JavaScript enabled
  • (Optional) Select2 library for enhanced dropdowns

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •