Chosen files are not coming up in my assets - jque

2020-08-05 09:54发布

问题:

I am trying to use chosen rails for my dropdown select.

I am following the exact steps from rails casts to integrate it to rails.

I am doing it using chosen-rails gem.

For some reason, the dropdown width is automatically set to zero via inline css.

here's the generated code via the inspect element.

<div class="chosen-container chosen-container-single" style="width: 0px;" title="" id="chosen_select_chosen"><a class="chosen-single" tabindex="-1"><span>s3
          </span><div><b></b></div></a><div class="chosen-drop"<ul class="chosen-results"><li class="active-result" data-option-array-index="0">s1
          </li><li class="active-result" data-option-array-index="1">s2
          </li><li class="active-result result-selected" data-option-array-index="2">s3
          </li><li class="active-result" data-option-array-index="3">s4
          </li><li class="active-result" data-option-array-index="4">s5
          </li><li class="active-result" data-option-array-index="5">s6
          </li></ul>
  </div>
  </div>

Now I want to change that width so that I can see the dropdown options properly. but the files chosen.css chosen.min.css are not there in my assets.

How do I go about it.

Please help.

回答1:

I used chosen for an ASP.NET application. When I had the problem of the dropdown being too narrow, I set the width to 100% in my javascript. Try setting the style="width: 100%;" and see if that fixes it. –