I'm running rails 3.2, and trying to add a rating system using this: http://wbotelhos.com/raty/ .
For some reason, even though I've added:
$('#rating').raty();
to my script, and
<div id="rating"></div>
to my html as shown at the website, I still can't see the stars.
I've added:
//= require jquery.raty
to my application.js, and have jquery.raty.js in my javascripts folder.
I can't seem to figure out what I'm doing wrong.
I've tried using a gem: https://github.com/bmc/jquery-raty-rails and that doesn't work either
Did you add the photos for the stars? Make sure that you have star-on.png and star-off.png in assets/images Also, add the following code in your html.erb file,
<script>
$(document).ready(function() {
$("#rating").raty({
path: '/assets/'
});
})
</script>
You need to include the javascript call:
$('#star').raty();
in order to get
<div id="star"></div>
to show.
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.