Destramic Posted May 7, 2010 Share Posted May 7, 2010 im trying to set this Date Picker script on my form page but its coming back with an error saying "object does not support this property or method" on this code <script>$(function() { $("#datepicker").datepicker(); }); </script> although the jquery/javascript files as included correctly its coming back with an error...does anyone know how i can fix this please?...thank you Quote Link to comment https://forums.phpfreaks.com/topic/201041-error/ Share on other sites More sharing options...
F1Fan Posted May 7, 2010 Share Posted May 7, 2010 What kind of element is id "datepicker"? Quote Link to comment https://forums.phpfreaks.com/topic/201041-error/#findComment-1054807 Share on other sites More sharing options...
Destramic Posted May 7, 2010 Author Share Posted May 7, 2010 its a jquery that pops a calender from a input field this might explain better http://marcgrabanski.com/pages/code/jquery-ui-datepicker Quote Link to comment https://forums.phpfreaks.com/topic/201041-error/#findComment-1054828 Share on other sites More sharing options...
F1Fan Posted May 7, 2010 Share Posted May 7, 2010 I know what jQuery datepicker is. I'm asking for the rest of your code. The jQuery date picker is supposed to be applied to a text input field, and your error appears to imply that you're applying it to a non-text field. Quote Link to comment https://forums.phpfreaks.com/topic/201041-error/#findComment-1054840 Share on other sites More sharing options...
Destramic Posted May 7, 2010 Author Share Posted May 7, 2010 sorry...here is the page im trying to get it to work on if that helps...but thats the only error im getting <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <link rel="stylesheet" type="text/css" href="/css/style.css" /> <link rel="stylesheet" type="text/css" href="/ajax/jquery/datepicker/datepicker.css" /> <script type="text/javascript" src="ajax/jquery/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="ajax/jquery/datepicker/datepicker.js"></script> <script type="text/javascript" src="ajax/jquery/datepicker/datepicker.core.js"></script> <script type="text/javascript" src="/javascript/inputEmbeddedImage.js"></script> <script type="text/javascript"> $(document).ready(function() { $(".inputWithImage").each(function(){ $(this).add($(this).next()).wrapAll('<div class="imageInputWrapper"></div>'); }); }); $(function() { $("#datepicker").datepicker(); }); </script> </head> <title></title> <body> <div id="addLeague"> <form action="" name="test" method="POST"> <label for ="start_date">Start Date:</label> <input name="start_date" type="text" class="inputWithImage" title="" id="datepicker" /> <img src="C:/www/images/calendar.png" alt="Calandar" onclick="alert('Popup some calendar here!');" /><br /> <input type="submit" value="Add League" title="Submit Form" /> <input type="reset" value="Reset" title="Reset Form" /> </form> </div> <br /> Quote Link to comment https://forums.phpfreaks.com/topic/201041-error/#findComment-1054851 Share on other sites More sharing options...
F1Fan Posted May 7, 2010 Share Posted May 7, 2010 You really should move it into the document.ready function. $(document).ready(function() { $(".inputWithImage").each(function(){ $(this).add($(this).next()).wrapAll('<div class="imageInputWrapper"></div>'); }); $("#datepicker").datepicker(); }); Quote Link to comment https://forums.phpfreaks.com/topic/201041-error/#findComment-1054854 Share on other sites More sharing options...
Destramic Posted May 7, 2010 Author Share Posted May 7, 2010 it is still coming back with the same error sorry on this line; $("#datepicker").datepicker(); Quote Link to comment https://forums.phpfreaks.com/topic/201041-error/#findComment-1054860 Share on other sites More sharing options...
F1Fan Posted May 7, 2010 Share Posted May 7, 2010 Hmm. Try calling the jQuery files absolutely, like you already are with the CSS files. <link rel="stylesheet" type="text/css" href="/css/style.css" /> <link rel="stylesheet" type="text/css" href="/ajax/jquery/datepicker/datepicker.css" /> <script type="text/javascript" src="/ajax/jquery/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="/ajax/jquery/datepicker/datepicker.js"></script> <script type="text/javascript" src="/ajax/jquery/datepicker/datepicker.core.js"></script> <script type="text/javascript" src="/javascript/inputEmbeddedImage.js"></script> Quote Link to comment https://forums.phpfreaks.com/topic/201041-error/#findComment-1054868 Share on other sites More sharing options...
Destramic Posted May 7, 2010 Author Share Posted May 7, 2010 still n luck...ive been trying for hours...im pickled haha Quote Link to comment https://forums.phpfreaks.com/topic/201041-error/#findComment-1054877 Share on other sites More sharing options...
F1Fan Posted May 8, 2010 Share Posted May 8, 2010 After some research, it looks like these types of errors are usually due to IE, a corrupted jQuery file, or a typo somewhere that causes it to not properly find the element with that ID. Are you listing all of your code? Maybe you have more than one ID with "datepicker." Have you tried multiple browsers? Quote Link to comment https://forums.phpfreaks.com/topic/201041-error/#findComment-1055130 Share on other sites More sharing options...
Destramic Posted May 8, 2010 Author Share Posted May 8, 2010 Sorry after many hours of I got it to work...dunno really how...just potching around haha...but thanks again Quote Link to comment https://forums.phpfreaks.com/topic/201041-error/#findComment-1055144 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.