javascript - Jquery timePicker for clone -
i have jquery timepicker. working fine, when clone row works on first row not on cloned rows.
this code :
<script> $(function() { $('#timepicker').timepicker({ 'timeformat': 'h:i' }); }); </script> <input id="timepicker" name = "time[]" type="text" class="time" />
i think using id call function. other better way ?
when clone row, initialize second timepicker.
this create problem though code have right because have duplicate id in dom. suggest change id
class
, when duplicate row call this:
$('.timepicker').timepicker({ 'timeformat': 'h:i' });
or remove id of input field , use this:
$('.time').timepicker({ 'timeformat': 'h:i' });
Comments
Post a Comment