0

I am using the bootstrap-timepicker for rails and I am using it in a form helper. It works very well if there is only one instance of it. Here is a code fragment:

<div class="bootstrap-timepicker input-append span2 offset0">
  <%= f.label :to_hour %>
  <input id="timepicker1" type="text" class="input-small" value='12:15 PM'>
  <span class="add-on"><i class="icon-time"></i></span>
</div>

However it doesn't work when there are multiple instances of it in a single page. Essentially I have multiple dynamic rows of data that require a time picker each and the examples that I have found were simple and had a unique input id and corresponding javascript.

Does anyone know how I can make this dynamic or know of any examples that demonstrates this?

4

1 回答 1

2

根本不要使用身份证。使用一个类:

<input type="text" class="input-small timepicker" value='12:15 PM'>

在你的 JS 中:

$(".timepicker").timepicker(...);
于 2013-05-29T07:14:59.437 回答