Object has no method datepicker

Viewed 21276

I'm getting the error Uncaught TypeError: Object [object Object] has no method 'datepicker' in my javascript here:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
<script type='text/javascript'>
$(function() {
    $("#birthday").datepicker({changeMonth: true});
});
</script>

Here's the birthday item that I'm trying to add it to:

<!--// BIRTHDAY //-->
<li class="field">
    <label for="birthday">Birthday</label>
    <div class="field"><input type="text" id="birthday" name="birthday" value="" class="" /></div>
</li>

As you can see, I'm including the source for jquery ui just above where I'm trying to use the datepicker. I got the URL from http://jqueryui.com/docs/Downloading_jQuery_UI so I'm pretty sure it's a valid URL. I also tried uploading the file and linking to the local copy and I still got the same error. What else can I try?

EDIT:

I do have the jquery library loaded using this: <script type="text/javascript" src="/includes/js/jquery-1.7.2.min.js"></script> and verified with this bit of script:

if (jQuery) {
    alert("jQuery library is loaded!");
}
4 Answers

$ will work like

$(function($) {
    $( "#dateTasted" ).datepicker({
      changeMonth: true,
      changeYear: true,
      dateFormat: "yy-mm-dd"    
    });
});
Related