I am confused about "delete the date format sector form filed and and edit the header code, it doesn’t work."
You remove the <select> from the DOM using .remove() ? How are you editing the header code?
Like this?
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8" />
- <title>datepicker- formats</title>
- <link href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
- <script src="http://code.jquery.com/jquery-1.9.0.js"></script>
- <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
- <script type="text/javascript">
- $(function(){
- $("#datepicker" ).datepicker()
- $("#format" ).change(function() {
- $("#datepicker" ).datepicker( "option", "dateFormat", $( this ).val() );
- $(this).remove()
- })
- })
- </script>
- <style type="text/css">
- #datepicker{width:200px}
- </style>
- </head>
- <body>
- <p>Format options:<br />
- <select id="format">
- <optgroup>
- <option>Select a format</option>
- <option value="mm/dd/yy">Default - mm/dd/yy</option>
- <option value="yy-mm-dd">ISO 8601 - yy-mm-dd</option>
- <option value="d M, y">Short - d M, y</option>
- <option value="d MM, y">Medium - d MM, y</option>
- <option value="DD, d MM, yy">Full - DD, d MM, yy</option>
- <option value="'day' d 'of' MM 'in the year' yy">With text - 'day' d 'of' MM 'in the year' yy</option>
- </optgroup>
- </select>
- </p>
- <input id="datepicker">
- </body>
- </html>
JΛ̊KE