Jquery UI with rails nested forms

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.

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>