Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery DatePicker not Loading

I have a piece of jQuery that will not load at all for some reason. I am wondering if it is an error in my syntax or if I am missing something crucial for it to work. This is placed on a page that is included.

<script>
jQuery(function() {
    jQuery( "#datepicker" ).datepicker();
});
</script>
<div class="demo">

<p>Date: <input type="text" id="datepicker"></p>
<?php echo "hello world againagain!"; ?>
</div>

This is in the header of index.php: /css/ui-lightness/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />

<script src="<?php echo $intranetName; ?>/js/jquery_1_6.js" type="text/javascript"></script>     
<script type="text/javascript" src="<?php echo $intranetName; ?>/js/jquery-ui-   1.8.16.custom.min.js"></script>

The intranetName loads the domain of the scripts. It does load the scripts and shows the correct path in the html source so I do not think that is the issue. However, I am still a novice to jQuery. Help please! Thanks.

I figured it out. It was due to my copy of jQuery being corrupted. Thank you everyone!

like image 690
wiseman7687 Avatar asked Dec 10 '25 18:12

wiseman7687


1 Answers

Include JQuery before JQuery-UI

<script src="<?php echo $intranetName; ?>/js/jquery_1_6.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo $intranetName; ?>/js/jquery-ui-1.8.16.custom.min.js"></script>

EDIT:

This is working fine on my local machine (i.e. showing datepicker without css):

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>

<script>
jQuery(function() {
    jQuery( "#datepicker" ).datepicker();
});
</script>
<div class="demo">

<p>Date: <input type="text" id="datepicker"></p>

So it must be a problem with your UI package.

like image 97
Vikk Avatar answered Dec 12 '25 09:12

Vikk