Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/201041-error/
Share on other sites

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 />

Link to comment
https://forums.phpfreaks.com/topic/201041-error/#findComment-1054851
Share on other sites

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();
     });

Link to comment
https://forums.phpfreaks.com/topic/201041-error/#findComment-1054854
Share on other sites

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>

Link to comment
https://forums.phpfreaks.com/topic/201041-error/#findComment-1054868
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/201041-error/#findComment-1055130
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.