I am attempting to use the datetimepicker control (http://timjames.me/jquery-ui-datetimepicker-plugin) but it appears my local js file is having trouble loading - but only in IE (version 8.0.6) as it works fine in Firefox version 18.0.
I use a master page named with placeholder "MainContent" so all of my child page controls need to be referenced by MainContent_ followed by the ID of the control.
The element in the master page contains the following script includes:
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.min.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/themes/hot-sneaks/jquery-ui.css" />
<script type="text/javascript" src="Scripts/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript">
$(document).ready(function () {
alert("hello");
$('#MainContent_calStart').datetimepicker();
});
</script>
script language="javascript" type="text/javascript">
function GetItem(strName) {
return document.all ? document.all[strName] : document.getElementById(strName);
}
... etc etc etc
My asp.net child page contain the code:
Basically, the page hosting the datetimepicker is not the first page loaded in the site, but due to the master page containing the script includes (and being unable to load them all), the first page of the site loads with js errors.
I cannot load/include ANY local JQuery files in to my site when using IE as I get Javascript error:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E) Timestamp: Tue, 15 Jan 2013 13:31:47 UTC
Message: Syntax error Line: 3 Char: 1 Code: 0 URI: (path to page on localhost)
The site bombs at line $('#MainContent_calStart').datetimepicker(); with error "Microsoft JScript runtime error: Object doesn't support this property or method" indicating the browser has been unable to find the source/declarations for the datetimepicker widget from within the include file. If I continue loading the site despite the js error, the datetimepicker widget loads and appears to be fully functional.
The strange thing is, if I take the code and create a sample website project in VS2010, and include the files/code as above, the sample site works. The only difference between the sample and my live site is there is additional pages/css/js files in the live site. The structure of the 2 sites is the same in terms of script locations/css locations etc. The sample site works fine in both IE and FF.
One final thing, if I move all of the code from jquery-ui-timepicker-addon.js into the master page itself and exclude the js file, the site works. This points to the fact the js code is not being loaded when in a local file.
Any help is appreciated. Cheers.
Jimmy
PS. I cannot include ANY local js file, not just the one in question.