I am trying to add two date pickers to my form, but can not get even one picker to display correctly. Here is the code I found. Thanks for any help.
<script type="text/javascript">
$('.datetime').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: 'h:m'
});
</script>
Here is my HTML
<tr>
<td><input type="text" name="expiration_date" class="" id="datepicker[0]" /></td>
<td><input type="text" name="action_date" class="" id="datepicker[1]" /></td>
</tr>
Im am new to javascript so thank you for your help.
That's because your selector i.e. $('.datetime')
is looking for all elements with a datetime
class set (of which you have none). All your input's all have class=""
, for this to work you need to change these to class="datetime"
i.e.
<input type="text" name="expiration_date" class="datetime" id="datepicker[0]" />
<input type="text" name="action_date" class="datetime" id="datepicker[1]" />
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments