Knockout Support in JQuery TimePicker widget

10 Aug 20177 minutes to read

Knockout support allows you to bind the HTML elements against any of the available data models.

Two types of Knockout binding supported,

  • One-way binding
  • Two-way binding

One way binding refers to the process of applying observable values to all the available properties of the TimePicker widget, where the changes made in the widget is not reflected and triggered in turn to the observable collection. This kind of binding applies to all the properties of the TimePicker widget.

Two-way binding supports both the processes – it applies the observable values to the TimePicker widget properties as well as the changes made in the TimePicker widget is also reflected back and triggered within the observable collections.

For more information about the Knockout binding, refer the following link location,

The following example depicts the way to bind data to the TimePicker widget through the Knockout support that enables and populate data to TimePicker widget based on the value set to another TimePicker widget.

  • HTML
  • <html>
        <title>Essential Studio for JavaScript : Timepicker Knockout</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8" />
        <!-- Style sheet for default theme (flat azure) -->
        <link href="" rel="stylesheet" />
        <script src=""></script>
        <script src=""></script>
        <script src=""></script>
        <script src=""></script>
        <script src=""></script>
        <!--Add custom scripts here -->
        <div class="content-container-fluid">
            <div class="row">
                <div class="cols-sample-area">
                    <div class="frame">
                        <div class="control" style="width: 136px;">
                            <label style="width: 130px;">Select Show Time </label>
                            <input id="time" type="text" data-bind="ejTimePicker:{value:timePickerValue }" />
                <div id="sampleProperties">
                    <div class="prop-grid">
                        <div class="row">
                            <div class="col-md-3">Time Value</div>
                            <div class="col-md-3">
                                <input type="text" id="timeValue" class="input ejinputtext" value="" data-bind="value: timePickerValue" />
                            <div class="col-md-3">Selected time</div>
                            <div class="col-md-3">
                                <input type="button" class="e-btn inputBtn" id="getTime" value="Get Time" />
        <script type="text/javascript">
            window.viewModel = {
                timePickerValue: ko.observable("11:30 AM")
            $(function () {
                // declaration
                var timeObj = $('#time').data("ejTimePicker");
                $("#getTime").click(function () {
                    alert("Selected time is : " + timeObj.getValue());
            .col-md-3 {
                padding-bottom: 5px;
            .cols-sample-area {
                width: 200px;
                height: 80px;
                float: left;


    jQuery.easing external dependency has been removed from version onwards. Kindly include this jQuery.easing dependency for versions lesser than in order to support animation effects.

    Execute the above code to render the following output.