I am very beginner to ruby on rails and web-development.
I created my app that similar to Ryan Bates, episode 197 and 198, but with use JQuery UI datepicker. But I dont really know how to do that. I know that the problem is with element ID always same whatever I generated new dynamic partial. For example, when I choose a day, it works fine. but when I add new nested model (or record), only the first nested model change.
I use ruby 1.8.7 and rails 2.3.1, I must use thses versions.
Please I was struggling with this. Any help will be appreciated.
<script type="text/javascript">
$('.datePicker').each(function() {
$(this).datepicker();
});
</script>
<div class ="fields">
<%= f.select(:assessmethods_id,@types,:include_blank=>true) %>
<%= f.text_field(:assessdate,:class => "datePicker") %>
<%= link_to_remove_fields("remove", f) %>
</div>
Why don't you try this:
<script type="text/javascript">
$(function() {
$('.datePicker').datepicker();
});
</script>
<div class ="fields">
<%= f.select(:assessmethods_id,@types,:include_blank=>true) %>
<%= f.text_field(:assessdate,:class => "datePicker") %>
<%= link_to_remove_fields("remove", f) %>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With