简体   繁体   中英

jQuery timepicker 'Object does not support this property or method'

I've been looking for a timepicker and finally found this one, timepicker , the problem is I can't get it to do anything..

here's my page:

<head runat="server">
<title>VTC Request Form</title>
<script type="text/javascript" src="Jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="Jquery/jquery-ui-1.8.17.custom.js"></script>
<script type="text/javascript" src="Jquery/jquery.ui.core.js"></script>
<script type="text/javascript" src="Jquery/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="Jquery/datetimepicker_css.js"></script>
<script type="text/javascript" src="Jquery/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="Jquery/jquery.ui.widget.js"></script>
<link rel="Stylesheet" href="Css/jquery-ui-1.8.17.custom.css"type="text/css" />

<script type="text/javascript">
        $(document).ready(function(){

          $("#datepicker").datepicker({});
          $('#StartTimeTextBox').timepicker({});
       });  
</script>

<form id="form1" runat="server">
<div>
<label>Date:</label><input type="text" id="datepicker" />
    </div>
    <div><label>Start Time:</label>
<input type="text" id="StartTimeTextBox" name="StartTimeTextBox" value=""/>
    </div>

the datepicker works fine, but the timepicker errors out- 'object doesn't support this method or property'

I guess you're missong Jquery slider

jQuery Timepicker Addon

Use

  • To use this plugin you must include jQuery and jQuery UI with datepicker and slider
  • Include timepicker-addon script
  • now use timepicker with $('#selector').datetimepicker() or $('#selector').timepicker()

Look at this page

https://github.com/trentrichardson/jQuery-Timepicker-Addon

I think you are simply completely messed up with script referencing.

Try this:

<script type="text/javascript" src="Jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="Jquery/jquery-ui-1.8.17.custom.js"></script>
<script type="text/javascript" src="Jquery/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="Jquery/datetimepicker_css.js"></script>

No need to re-reference separate jquery ui files if you include the full library (jquery-ui-1.8.17.custom.js)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM