make an input only-numeric type on knockout

Is better to create custom binding http://knockoutjs.com/documentation/custom-bindings.html which accept only allowed characters [0-9,.] as numeric representation. put this line into your view <input id=”text” type=”text” data-bind=”numeric, value: number”> put this line into your model (remember to bind number as observable property) ko.bindingHandlers.numeric = { init: function (element, valueAccessor) { $(element).on(“keydown”, function (event) { // Allow: … Read more