Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

select2 laravel does not work


The output in select2 with the bootstrap5 theme does not work

<select class="form-select form-select-solid" data-control="select2" data-placeholder="Select an option">
<option></option>
...
</select>


<img src="


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


Glad you have solved it and thanks for sharing the solution.

Thanks



Hi,

Could you please check the console log if there is any error? We will check it further.

Thanks



Hi,

I solved my problem, I included the file "plugins-custom.bundle.css" manually because I don't use the default project of laravel that I find too heavy and useless for our use.

Thanks



I had the same issue, this was the workaround that worked for me:


$(document).on("select2:open", () => {
let allFound = document.querySelectorAll(".select2-search__field");
allFound[allFound.length - 1].focus();
});



Thank you for your reply but I think the problem is certainly with the css code.
It works correctly with the html version but the Laravel version is buggy


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(