Open onet4 opened 10 years ago
Hi, thanks for the nice work!
I've been trying to create repeatable fields with this script and noticed that it looses the binding to the input element when the input ID changes. The picker window is still bound and will pop up but it does not set the date and time anymore.
It would be great if this is possible.
Example
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" media="all" type="text/css" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" /> <link rel="stylesheet" media="all" type="text/css" href="jquery-ui-timepicker-addon.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script> <script type="text/javascript" src="jquery-ui-timepicker-addon.js"></script> <script type="text/javascript" src="jquery-ui-sliderAccess.js"></script> </head> <body> <div class="example-container"> <input type="text" name="basic_example_1" id="basic_example_1" value="" /> </div> <script type="text/javascript"> $(function(){ $( '#basic_example_1' ).datetimepicker(); }); $(function(){ var input_id = $( '#basic_example_1' ).attr( 'id' ); var new_id = input_id.replace( /_(\d)/g, function ( entire_match, m0 ) { return '_' + ( Number( m0 ) + 1 ); }); $( '#basic_example_1' ).attr( 'id', new_id ); }); </script> </body> </html>
Hi, thanks for the nice work!
I've been trying to create repeatable fields with this script and noticed that it looses the binding to the input element when the input ID changes. The picker window is still bound and will pop up but it does not set the date and time anymore.
It would be great if this is possible.
Example