Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I developed an HTML page with a JQuery <->Date picker & when I click on the particular text boxes it is not displaying. The source code is as at the below.

HTML
>
	<head>
	      <link rel="stylesheet" href="jquery-ui.css" />
		  <link rel="stylesheet" href="jquery-ui.min.css" />
          <link rel="stylesheet" href="jquery-ui.structure.css" />
          <link rel="stylesheet" href="jquery-ui.structure.min.css" />
          <link rel="stylesheet" href="jquery-ui.theme.css" />
          <link rel="stylesheet" href="jquery-ui.theme.min.css" />
		  
		  <script src="jquery-ui.js"></script>
		  <script src="jquery-ui.min.js"></script>
		  
		  <script>
		  
			$(document).ready(function(){ 
			$("#txtFromDate").datepicker({ numberOfMonths: 2, onSelect: function(selected) { 
              $("#txtToDate").datepicker("option","minDate", selected) 
			  } }); 

            $("#txtToDate").datepicker({  
              numberOfMonths: 2, 
              onSelect: function(selected) { 
              $("#txtFromDate").datepicker("option","maxDate", selected) 
             } });   
             }); 

			 /* numberOfMonths will determine the months that will display in the Calander control.*/
		  </script>
		  
	      <title>Validating JQuery Date Less Than Selected Date</title>
    </head>
	
    <body>

		<br/>
		From: <input type="text" id="txtFromDate" />
	    To: <input type="text" id="txtToDate" />
		<br/>
	
	</body>
</html>


I cannot find what I had done wrong. I did this as with Google API, and there was not any error and it works perfectly. I cannot understand the matter.

Could someone look at into the matter I have mentioned.

Thanks & Regards,
Chiranthaka
Posted
Comments
Kornfeld Eliyahu Peter 8-Jul-14 6:08am    
Why you are including full and minified versions of CSS and JavaScript files?
That because you do not know what these are?
Remove the minified version and try to debug it...
Chiranthaka Sampath 8-Jul-14 6:24am    
I have removed that minified scripts but still the problem is existing.
Chiranthaka Sampath 8-Jul-14 6:17am    
I have removed that minified scripts but still the problem is existing.

It was hard to spot - but you should have it if you would use debug of the browser...
You have no reference to jquery.js in your page!!! jquery-ui.js requeires jquery.js to work!!!

My version of your sample code - works perfectly...
HTML
<!DOCTYPE html>

<html>
<head>
    <title>Validating JQuery Date Less Than Selected Date</title>
    <link href="Content/themes/base/jquery-ui.css" rel="stylesheet" />
    <script src="Scripts/jquery-2.1.1.js"></script>
    <script src="Scripts/jquery-ui-1.10.4.js"></script>
</head>
<body>
    From: <input type="text" id="txtFromDate" />
    To: <input type="text" id="txtToDate" />

    <script type="text/javascript">

        $(document).ready(function () {
            $("#txtFromDate").datepicker({
                numberOfMonths: 2, onSelect: function (selected) {
                    $("#txtToDate").datepicker("option", "minDate", selected)
                }
            });

            $("#txtToDate").datepicker({
                numberOfMonths: 2,
                onSelect: function (selected) {
                    $("#txtFromDate").datepicker("option", "maxDate", selected)
                }
            });
        });
    </script>
</body>
</html>
 
Share this answer
 
v4
Comments
Chiranthaka Sampath 8-Jul-14 6:58am    
I have edited the source code as at the below by adding the reference to the JQuery.js file but cannot find what I have done wrong? Could you look at this matter again?

<script src="jquery.js"></script>
Kornfeld Eliyahu Peter 8-Jul-14 7:07am    
And do you have a jquery.js file at your hand?
Chiranthaka Sampath 8-Jul-14 7:10am    
Yep I have it with my html page within the same folder.
Kornfeld Eliyahu Peter 8-Jul-14 7:13am    
So it is now time to learn using your browsers build in debugger...
Open it and see console errors...
Chiranthaka Sampath 8-Jul-14 7:21am    
I'm using Internet Explorer 8.0. Will I able to debug the script using it?
The Problem was that I have used JQuery 2.x instead of JQuery 1.x. JQuery 2.x supports Internet Explorer 9.0 and beyond 9.0. So the real thing is Internet Explorer 8.0 is old and not compatible with new versions of JQuery.
 
Share this answer
 
Sol: Reference path to below files not found.

link rel="stylesheet" href="jquery-ui.css" />
<link rel="stylesheet" href="jquery-ui.min.css" />
<link rel="stylesheet" href="jquery-ui.structure.css" />
<link rel="stylesheet" href="jquery-ui.structure.min.css" />
<link rel="stylesheet" href="jquery-ui.theme.css" />
<link rel="stylesheet" href="jquery-ui.theme.min.css" />

for more details, debug the page in browser. Press F12 and then escape if you have chrome
 
Share this answer
 
v3
Comments
Kornfeld Eliyahu Peter 8-Jul-14 6:34am    
What are you talking about?!
Chiranthaka Sampath 8-Jul-14 7:06am    
Pal, I tried both the solutions but the error is still existing. So how am I going to solve the matter?

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