Unknown error in calendar function...
Hi,
I'm trying to implement the datetimepicker, rome-plugin in my rails application but I'm receiving an unkown error. (please know this is the first time that I'm implementing such a plugin) so it might be a basic error.
My view:
<% @properties.where(:location_id => l.id).each do | p | %>
<tbody>
<tr>
...//removed some other code here to go to the problem //..
<td data-title="Meeting Slot">
<input id='input' class='input' />
<script>rome(input);</script>
</td>
</tr>
</tbody>
<% end %>
The error I'm receiving: Uncaught TypeError: o.appendTo.appendChild is not a function via: calendar.js:67
Line 67 is:
api.back = subtractMonth; This refers to line 1224 of the rome.standalone.js file
What I've done so far:
- load Moment.js via the 'momentjs-rails' gem
- Create a file rome.standalone.js in my assets/javascript folder with a copy paste of the rome;standalone.js file which can be found on the github page.
- added the input and script file on my view.
Anyone who can help me figure out what is wrong?
Many thanks, T
UPDATE: If I paste my view code to the top of the page, outside the table, it gives no error but still doesn't load the datetimepicker...
I have the same problem. No solution so far.
I'm not sure (yet) how @bevacqua was loading his DOM elements, but you need to pass in a DOM element for the calendar to work. once i changed the argument to rome() to the result of a document.getElementById() call, the calendar worked fine.
to clarify:
var input = document.getElementById('myinput');
rome(input); // works fine.