Bootstrap Select2 Codes and Example Usage

Hi,
We will talk about select2 codes and example usage using Bootstrap infrastructure.

What we call Select2 is the same as we know, only a slightly more advanced version. Select2 allows you to search through the options.

select, select2, 2, bootstrap, free, template, webmaster

All codes are below and you can edit according to yourself 🙂

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">

<select class="form-control select2" id="mySelect">
  <option value="1">Seçenek 1</option>
  <option value="2">Seçenek 2</option>
  <option value="3">Seçenek 3</option>
  <option value="4">Seçenek 4</option>
  <option value="5">Seçenek 5</option>
</select>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script>

<script>
$(document).ready(function() {
  $('.select2').select2({
    placeholder: 'Arama...',
    allowClear: true,
    width: '100%'
  });
});
</script>
5/5 - (18 votes)

He is a white-collar software developer who lives by his own mind. By purchasing the webdimi.net domain name, he wants to be informed about the content he enters and the content he enters.

1 thought on “Bootstrap Select2 Codes and Example Usage

Leave comment

Your email address will not be published. Required fields are marked with *.

error: Content is protected !!