troubleshooting Question

Setting the Width on a Select2 Placeholder - shows as 0 width

Avatar of Starr Duskk
Starr DuskkFlag for United States of America asked on
3 Comments1 Solution155 ViewsLast Modified:
I have two multiple select2 drop down lists on two different pages.

One has a width set for the placeholder, and the other does not when I do an inspect, but I copied the code setup for the first to the second and can't find anywhere that an actual width is being set. The failing one has the width set to 0. The successful one has the width set to 288. But I find 288 no where in my code.

<input class="select2-search__field" type="search" tabindex="0" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" aria-autocomplete="list" placeholder="[Select]" style="width: 0px;">

both use the exact same method:

placeholder: '[Select]',
allowClear: true,
matcher: function (params, data) {
    return matchStart(params, data);
width: 'resolve',
allowClear: true,
multiple: true,scrollAfterSelect: false,closeOnSelect: false

Any ideas where I can find where that width is set? When I create each method, the width is set to 'resolve'

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros