Readonly attribute in knockoutjs

HTML:

<input data-bind="value: text, readOnly: locked"  ></input> 

In knockout:

  ko.bindingHandlers.readOnly = {
    update: function(element, valueAccessor) {
        var value = ko.utils.unwrapObservable(valueAccessor());
        if (value) {
            element.setAttribute("readOnly", true); 
        }  else {
            element.removeAttribute("readOnly");
        }  
    }  
}
 
var viewModel = {
   
    locked = ko.observable(false)
};

Tab out of knockout datepicker

Need to add this to the data-bind parameters:

onClose: function(dateText) {
$(this).focus();
}

example:

<input style="float:left;" placeholder="Date of Birth" id="studentDOB" class="textAnswer datepickerDOB" type="text" 
    data-bind="datepicker: {
            onClose: function(dateText){$(this).focus();},
            changeMonth:true,
            changeYear:true,
            yearRange: '-25:c'},
    value : studentDOB, valueUpdate: 'input'" />