Chosen files are not coming up in my assets - jquery chosen in rails

本秂侑毒 提交于 2019-12-12 09:28:12

问题


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. –



来源:https://stackoverflow.com/questions/29643721/chosen-files-are-not-coming-up-in-my-assets-jquery-chosen-in-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!