Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This function is not work, can somebody help!!!
I am beginner.

JavaScript
$( "#format" ).change(function() {
	$( "#datepicker" ).datepicker( "option", "dateFormat", $( this ).val() );
	
	if ($( "#format" ) == "yy MM dd") {
	$( "#format" ).click(function () 	{
	var inputString = $(document.getElementById ("#datepicker")).val();
  	var shortenedString = inputString.substr(0,(inputString.length -2));
	$( "#datepicker" ).val(shortenedString);
			});
                  }
	
		});

HTML
<p>Date: <input type="text" id="datepicker" size="30"></input>
<p>Format options:<br>
<select id="format">
<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="yy MM d">Medium - yy MM d</option>
<option value="DD, d MM, yy">Full - DD, d MM, yy</option>
<option value="yy MM dd">Year mounth</option>
</select>
</br>


thanks.
Posted
Comments
Please debug the code by writing debugger; inside the function.
Also check the Developer Tool Like FireBug's Console window in Firefox if you see any errors or not,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900