简体   繁体   中英

jquery rails with twitter bootstrap does not render

I have made some progress here: rails 3 does not render jquery properly

With my test application, it works OK but with twitter bootstrap loaded - it does not work and it shows the drop down menu (which should be a palette). I have gone through steps to verify whether the jquery in rails renders the palette properly and this is my implemention to the one with twitter bootstrap.

As written in the post above, i had written the code into application.js:

//= require jquery
//= require jquery_ujs
//= require jquery.simplecolorpicker.js
//= require twitter/bootstrap
//= require_tree .
jQuery(document).ready(function(){
       jQuery('#print_colorpaper').simplecolorpicker();
    });

application.css

 *= require_self
 *= require jquery.simplecolorpicker.css
 *= require_tree .

erb file

<%= f.select(:colorpaper, Print::MY_COLORS, :selected => '#ff887c') %>

You don't need to include css in the end of the file, try this in application.css

*= require jquery.simplecolorpicker

Or even put that file in app/assets/stylesheets and require_tree . will pick it up automatically.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM