> For the complete documentation index, see [llms.txt](https://javascriptuse.gitbook.io/advanced/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://javascriptuse.gitbook.io/advanced/select2-tags-ok.md).

# \[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.

![](/files/-MQUlgoXvLykfnLDMT9A)

![](/files/-MQUlkXP-HIe2ZO8wSRA)

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>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://javascriptuse.gitbook.io/advanced/select2-tags-ok.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
