Search code examples
javascripthtmlcssasp.nettimepicker

Using Javascript in asp.net for timepicker control


I'm trying to use this TimePicker Control http://trentrichardson.com/examples/timepicker/ but I'm new in web programming so I need a little help,

I have this so far but is not working

<script src="../Scripts/jquery-ui-timepicker-addon.js"></script>
<link href="../Content/css/jquery-ui-timepicker-addon.css" rel="stylesheet" />    
<asp:UpdatePanel ID="upEdit" runat="server">
  <ContentTemplate>
    <div class="modal-body">
      <table class="table">
        <tr>
          <td><input type="text" name="basic_example" id="basic_example" class="hasDatepicker" >
            <script type="text/javascript">
              function timepic() {
                $('#basic_example').timepicker(
                  $.timepicker.regional['es'])
              };
            </script>
          </td>
        </tr>
      </table>
    </div>
  </ContentTemplate>
</asp:UpdatePanel>

What I'm doing wrong? Thanks for the help


Solution

  • Change your javascript function to,

    $(document).ready(function() {
        $('#basic_example').timepicker(
            $.timepicker.regional['es'])
    });
    

    Add it at the end of page.