# \[SELECT2] tags (ok)

#### 1. Sử dụng tags = true ngược lai nếu không sử dụng tags=true bạn sẽ không thêm được thẻ a.

![](https://2726517656-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1E4Gk2ppVKb4olmnun%2F-MQUaxv60-xa2ceh7NdC%2F-MQUlgoXvLykfnLDMT9A%2FScreenshot_1.jpg?alt=media\&token=f6579dec-b7c2-405b-b98c-46e76b2e8bd2)

![](https://2726517656-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1E4Gk2ppVKb4olmnun%2F-MQUaxv60-xa2ceh7NdC%2F-MQUlkXP-HIe2ZO8wSRA%2FScreenshot_2.jpg?alt=media\&token=825e5f6f-fcd1-45f7-b07c-8c6282becce7)

C:\xampp\htdocs\php\lang.php

```
<!DOCTYPE html>
<head>
  <title></title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" />
  <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" />
  <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/js/select2.min.js"></script>
  <style type="text/css">
  .flag {
    width: 15px;
    height: 15px;
    margin-right: 5px;
  }
  </style>
</head>
<body>
    <select id="tags" multiple="multiple" style="width: 400px;">
      <option value="Kerry" selected="selected">Kerry</option>
      <option value="Cork">Cork</option>
  </select>
  <script type="text/javascript">
    jQuery(document).ready(function($) {
      $('#tags').select2({
          tags: true,
          data: ["Clare","Cork","South Dublin"],
          tokenSeparators: [','], 
          placeholder: "Add your tags here",
          selectOnClose: true, 
          closeOnSelect: false
      });
    });
  </script>
</body>
</html>
```
