Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery DatePicker not showing

Hello I'm trying to create a simple textbox with a datepicker that appears when a user clicks inside of the it. I have the following loaded in my header:

<link rel="stylesheet" href="css/start/jquery-ui-1.8.13.custom.css">
<script src="js/jquery-1.5.1.min.js"></script>
<script src="js/jquery-ui-1.8.13.custom.min.js" type="text/javascript"> </script><!-- Was missing closing tag
<script>
    $(function() {
        $( "#datepicker" ).datepicker();
    });
</script>

And in my body, I have the following textbox:

<body>

    <input id="datepicker" class="hasDatepicker" type="text">

</body>

My problem is that when I try to click inside the text box, nothing happens. I'm not sure what the problem might be. Any suggestions are appreciated.

UPDATE:

Tried the CDN and also downloaded the entire jQuery UI package and still won't show. Tried in both IE and Firefox.

UPDATE 2:

Was hoping that syntax error I corrected above would fix it, but no dice.

like image 562
kingrichard2005 Avatar asked Mar 10 '26 03:03

kingrichard2005


1 Answers

jQuery UI adds the "hasDatepicker" class to the input after it is clicked. Try removing the hasDatepicker class. If you are using a jQuery selector such as $('.hasDatepicker') to select the input(s), try giving it another class name.

like image 192
Chris Peterson Avatar answered Mar 12 '26 17:03

Chris Peterson