This works for me with jQuery UI 1.7.2
var mydiv = $('#someDiv');
mydiv.find('input.datefield').datepicker();
var newDiv = mydiv.clone(false).attr("id", "someDiv2").insertAfter(mydiv);
newDiv.find('input.datefield')
.attr("id", "")
.removeClass('hasDatepicker')
.removeData('datepicker')
.unbind()
.datepicker();
Check http://jsbin.com/ahoqa3/2 for a quick demo
btw. you seem to have different errors in the code of your question. The css class is hasDatepicker
not hadDatepicker
and at one time you wrote mydiv
and the next time the variable is myDiv
which isn’t the same.