问题
The question is very simple. I have everything included properly, but the datepicker just won't show up. I have the script added in my html head tag:
<script type="text/javascript" src="<?php echo site_url('js/jquery-1.10.2.min.js'); ?>"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
<link rel="stylesheet" href="<?php echo site_url('css/jquery.ui.core.css'); ?>">
<link rel="stylesheet" href="<?php echo site_url('css/jquery.ui.datepicker.css'); ?>">
Than the date picker code...
<input type="text" name="date" id="date">
<script type="text/javascript">
$(document).ready(function() {
$( "#date" ).datepicker({ dateFormat: "yy-m-d" });
});
</script>
And that's it. There's no date picker or anything on that text input. Also no error... :(
回答1:
include jquery before jquery ui.
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
working code
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(function() {
$( "#date" ).datepicker();
});
</script>
Date:
来源:https://stackoverflow.com/questions/19344977/jquery-ui-cant-get-datepicker-to-work