0

I am trying to enter a number as 12.11, after decimal I just want to enter maximum of 11. If i try to enter 12.12 it should not take.

Murad Hasan
  • 9,565
  • 2
  • 21
  • 42
danush
  • 13
  • 2
  • If that refers to some input tag on the client side, so inside the browser, then you have to implement a handler function bound to the `change` or better the `keyup` event of that tag. The function fetches the value, validate it and then acts any way you want. – arkascha May 22 '16 at 06:49
  • You need JavaScript here. – Murad Hasan May 22 '16 at 06:53
  • Assuming you want this checked in the browser, this has nothing to do with PHP and you should remove the tag. – Jeremy J Starcher May 22 '16 at 06:58

1 Answers1

0

I would suggest looking this stackoverflow question, where is explained how to get the whole part of the number and the fractional part. Then you can just compare the fractional part to 12 or which ever number you want.

Community
  • 1
  • 1
Mihkel Allorg
  • 929
  • 1
  • 8
  • 26