user2124857
user2124857

Reputation: 39

jQuery - datepicker

I know there were tones of questions like this - but I can't get this working.

<script type="text/javascript">
    $(document).ready(function(){
        $("#input-datepicker").datepicker();
        });
</script>

Displays an error that there's no datepicker() function.

I tried so many script including combinations, none works. This is the current one:

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>

I tried adding type="text/javascript", placing includes above/below the form, changing $("#input-datepicker") into div containing the field...nothing.

Can you help me?

EDIT.

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $("#bbb").datepicker();
    });
</script>
<div id="input-datepicker" class="input">
    <label  for="bbb">Calendar</label>    <input name="bbb" id="bbb" type="text" />
</div>

EDIT 2.

<link type="text/css" href="..." rel="stylesheet" /> 
<form action="..." method="post" id="form" accept-charset="utf-8" enctype="multipart/form-data">    <div id="input-file" class="input">
    <label for="aaa"></label>    <input  type="file" name="aaa" id="aaa"  </div><script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $("#bbb").datepicker();
    });
</script>
<div id="input-datepicker" class="input">
    <label  for="bbb">Calendar</label>    <input name="bbb" id="bbb" type="text" />
</div>
<div id="input-submit" class="input">
    <input type="submit" name="submit" value="submit" />
</div>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
// ...
</form>

Upvotes: 0

Views: 1458

Answers (1)

SteveP
SteveP

Reputation: 19093

Check that your input field id matches the id in the jquery selector you are using (input-datepicker).

The jquery example is here: http://jqueryui.com/datepicker/

Upvotes: 1

Related Questions