Select Dropdown with Search Box

First, include the required CSS and JavaScript files in your HTML file. You can host these files yourself or use a CDN.

<!DOCTYPE html>
<html lang="en">

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Select Dropdown with Search</title>
    <!-- Bootstrap CSS -->
    <link href="" rel="stylesheet">
    <!-- Select2 CSS -->
    <link href="" rel="stylesheet">


    <div class="container mt-5">
        <h2>Select Dropdown with Search</h2>
        <select class="form-control" id="selectDropdown">
            <option value="1">Option 1</option>
            <option value="2">Option 2</option>
            <option value="3">Option 3</option>
            <option value="4">Option 4</option>
            <option value="5">Option 5</option>

    <!-- Bootstrap JS -->
    <script src=""></script>
    <!-- Select2 JS -->
    <script src=""></script>

        // Initialize Select2 plugin
        $(document).ready(function() {



In this example, the select2 plugin is applied to the <select> element with the ID selectDropdown. You need to ensure that you have included the jQuery library before this script if it’s not already included elsewhere in your project.

Make sure to replace the placeholder option values and text with your actual dropdown options. This code snippet assumes you’re using Bootstrap 4.x and want to implement a select dropdown with search functionality.