简体   繁体   中英

Clear Datetimepicker field. Bootstrap 3

When a section is hidden in my Dynamics Portal I want to clear the DateTimePicker field in that section.

I have tried this and many similar functionalities:

$('#myDateField').datetimepicker("clearDates");

I get this error: Uncaught Error: bootstrap-datetimepicker("clearDates") method was called on an element that is not using DateTimePicker.

'myDateField' is the ID of the field when I do an inspect on the date field.

I am unsure if I am using the method wrongly or simply point to the wrong field ID

I found out that I was calling the datetimepicker in a wrong fashion. Due to the way the datetimepicker is wired up, it should be accessed and cleared like this:

$('input[aria-describedby="myDateField_description"]').val(null);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM