How do I *completely* remove a jQuery UI datepicker?

This removes .datepicker COMPLETELY:

$( selector ).datepicker( "destroy" );
$( selector ).removeClass("hasDatepicker").removeAttr('id');

Documentation:
https://api.jqueryui.com/datepicker/#method-destroy
also read the comments below


I solved the problem by removing the datepicker classes and then calling the unbind method on the element tied to the datepicker. That seemed to get rid of it!

eg:

$('#myelement').datepicker();

/////////datepicker attached to myelement//////

and then:

$('#myelement').removeClass('calendarclass');
$('#myelement').removeClass('hasDatepicker');
$('#myelement').unbind();

Just removing the classes still let the input element invoke the datepicker when clicked in. possibly unbind() by itself would do the job, but I'm kind of a belt-and-braces chap.