0

Trying to Attach jquery time picker plugin to textbox in asp.net project. But when running in firefox getting the error "TypeError: $(...).timepicker is not a function".

and the below files used in site.master

<head runat="server">
<%--<script src="Scripts/jquery-1.7.1.js" type="text/javascript"></script>--%>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="Scripts/jquery-ui-1.8.20.js" type="text/javascript"></script>
<script src="Scripts/bootstrap-datepicker.js"></script>  <%--v2.0--%>
<link href="Scripts/bootstrap-datepicker.css" rel="stylesheet" /> <%--v2.0--%>
<script src="Scripts/jquery.timepicker.js"></script>  <%--v1.9.0--%>
<link href="Scripts/jquery.timepicker.css" rel="stylesheet" />  <%--v1.9.0--%>
<link href="Content/Site.css" rel="stylesheet" />
<meta charset="utf-8" />
<title><%: Page.Title %> - My ASP.NET Application</title>
<asp:PlaceHolder runat="server">
    <%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
<webopt:BundleReference runat="server" Path="~/Content/css" />
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
<asp:ContentPlaceHolder runat="server" ID="HeadContent" />

and i am using time picker in Default content page as below.

<script>
    $(function () {
        $('#FromtimeTextBox1').timepicker();
        $('#TotimeTextBox1').timepicker();
    });

what i am doing wrong here, how to solve this.....

Thanks.

Jilani pasha
  • 389
  • 3
  • 14

2 Answers2

0

Ok have a look at below code, i have tried in my local system and its working, just take care of sequncing of file - try to sequence file as i done below. Try in jsfiddle: http://jsfiddle.net/e5jzdqug/

<html>
<head>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/ui-lightness/jquery-ui.min.css">
<link rel="stylesheet" href="http://www.jqueryscript.net/demo/Customizable-jQuery-Timepicker-Plugin-timepicker/jquery.timepicker.css">

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

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.0/js/bootstrap-datepicker.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.0/css/bootstrap-datepicker.css">

<script type="text/javascript" src="http://timepicker.co/resources/jquery-timepicker/jquery.timepicker.min.js"></script>
<link rel="stylesheet" href="http://timepicker.co/resources/jquery-timepicker/jquery.timepicker.min.css">


<script type="text/javascript">
    $(document).ready(function(){
        $('#FromtimeTextBox1').timepicker();
        $('#TotimeTextBox1').timepicker();
    });
 </script>
</head>
<body>

<input id="FromtimeTextBox1" type="text">
<input id="TotimeTextBox1" type="text">
</body>
</html>
Dhara Parmar
  • 8,021
  • 1
  • 16
  • 27
0

you missing something.

first check "Scripts/jquery.timepicker.js".

second press f12 and right click chrome refresh button then clear cache.

third check this example.

codepen.io/airsakarya/pen/rerKRV
Hakkı
  • 811
  • 2
  • 13
  • 23
  • what you want me to check in "Scripts/jquery.timepicker.js", i am using firefox for output and i also cleared and refreshed but no change. – Jilani pasha Apr 23 '16 at 07:01
  • just open that address in your browser. it would be like "http://localhost/yourwebsite/Scripts/jquery.timepicker.js" – Hakkı Apr 23 '16 at 07:46