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

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -