Reputation: 1009
I'm trying to create a timer into my Rails. But I'm getting this error:
jquery.countdown.min.self-6add0e5….js?body=1:7 Uncaught TypeError: Cannot read property 'createPlugin' of undefined
I add :
jquery.countdown.min.js
into assets/javascripts
jquery.coundown.css
into assets/stylesheets
jQuery.js
is there and working properlyapplication.js
- //= require jquery.countdown.min
application.scss
- *= require jquery.countdown
Then i create:
VIEW
<th width="20%" class="timeRem" data-countdown-until="<%= 10.days.from_now %>"></th>
timer.js.coffee
Timers =
init: ->
@initCountdownUntil()
@initCountdownSince()
initCountdownUntil: ->
$('[data-countdown-until]').each (index, element) ->
$element = $(element)
date = new Date($element.data('countdown-until'))
$element.countdown(until: date)
initCountdownSince: ->
$('[data-countdown-since]').each (index, element) ->
$element = $(element)
date = new Date($element.data('countdown-since'))
$element.countdown(since: date)
window.Timers = Timers
Don't rally know how to fix it, appreciate any advice and help with that.
Upvotes: 0
Views: 2492
Reputation: 2683
You place the scripts on the page in this order jquery.js
then jquery.plugin.js
then jquery.countdown.js
[
ref: http://keith-wood.name/countdown.html
Upvotes: 2
Reputation: 11823
As per our comments, jquery.countdown.min.js
file should be placed before jquery.min.js
.
Upvotes: 1