Skip to content

Latest commit

 

History

History

Lesson_4

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Lesson 4 – calculating the amount #2

The total amount gets updated when we change the checkbox. But when the input gets changed nothing happens. We would like to add a handler which removes the format from the numbers in the inputs when focused. After the change has been made the number in the input should be formatted again. Disclaimer: we still use the German notation for numbers.

The calculation should be performed on every change but invalid inputs (like with letters) should be ignored in the calculation (as if the input is zero).

Covered in this lesson

  • handling change events (for the inputs)
  • modify values on actions
  • formatting numbers with RegEx
  • formatting numbers with Intl.NumberFormat

Get to the code