i read many tutorials but i dont know how to do this, this is the input
input(type=\"text\",name=\"price\",id=\"price\"data-bind=\"text: price,valueUpdate:[\
I had a similar problem.
I also needed to ensure inter values only, and for IE9 and up (so type=numberical was not enough), and since we have a lot of international customers, i could not rely on keycodes either, so the following is what i ended up with:
//In my js class method (self is this as usual)
self.ensureNumberical = function (data, e) {
var keyValue = e.key;
if (keyValue.match(/[0-9]/g)) {
return true;
}
return false;
}
//In my MVC View
data-bind="event: { keypress: ensureNumberical }"