jQuery Date Picker Input Date Format

http://stackoverflow.com/questions/11104933/jquery-date-picker-input-date-format

HTML

<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css">
Shown Field : <input id="thedate" type="text" /><br />
Hidden Field : <input id="thealtdate" type="text" /><br />
<input id="thesubmit" type="button" value="Submit" />

CSS

.updatedClassLeft{
    position: absolute;
    top: 8px;
    left: 0px;
    cursor: pointer;
}
.updatedClassRight{
    position: absolute;
    top: 8px;
    right: 2px;
    cursor: pointer;
}

JavaScript

$(function(){
    
    $('#thedate').datepicker({
        dateFormat: 'dd-mm-yy',
        altField: '#thealtdate',
        altFormat: 'yy-mm-dd',
        prevText: "Prev",
        nextText: "Next"
    });
    
    replaceIcon = function(){
			$('.ui-icon.ui-icon-circle-triangle-w').parent().removeAttr('class').attr('class', 'updatedClassLeft');
      $('.ui-icon.ui-icon-circle-triangle-w').removeAttr('class');
      
      $('.ui-icon.ui-icon-circle-triangle-e').parent().removeAttr('class').attr('class', 'updatedClassRight');
      $('.ui-icon.ui-icon-circle-triangle-e').removeAttr('class');
      
    }
    
   
    $("#thedate").on("click", function(){
    	replaceIcon();
 		});
    
    $(document).on('click','.updatedClassLeft, .updatedClassRight',function(){
    	replaceIcon();

    });
});