Hello folks,
I'm struggling with datePicker when I need to load it within a RJS
file.
Basically I have a drop-down menu and according to the selected value
I display some form fields (rendering a partial for selected value
within a RJS file); one of those has to be the datepicker but I can't
correctly load it.

the rjs looks like

...
@tasks.each do |task|
    page.insert_html :bottom, :tasks, :partial => 'tasks/task'
 end
...

and the partial looks like

<% fields_for "project[task_attributes][]", task do |t_form| %>
...
<input name="date2" id="date2" class="date-pick" />
...


I tried to load the picker within the RJS

page << "$(function() {$('.date-pick').datePicker();});"

and I tried to load it within the partial

<script type=\"text/javascript\">
     $j(function() {$j('.date-pick').datePicker();});
 </script>"
<% fields_for "project[task_attributes][]", task do |t_form| %>

but in neither cases it works.


How can I correctly load it?

THANK YOU, I APPRECIATE YOUR HELP


have a hood 1!

Reply via email to