I am looking for an affordable way to determine if a field should accept integer or decimal amounts. The <input> fields are presented in two versions: a simple <input> , which is designed for decimal values (in dollars and cents) and a <input> with a final ".00", which indicates that an integer is required (only dollars).
Example:

Since ".00" is not in <label> , it will not be read by a screen reader. I had to use an ugly hack to make it accessible:
<label>Total amount due ($): <span style="display:none;">Please enter dollars and cents</span></label> <label>Amount owed ($): <span style="display:none;">Please enter a dollar amount</span></label>
(Although the space is hidden, JAWS will read it when the input has focus.)
What is a more accessible and semantic way of informing assistive technologies about which numbering format is being requested?
Some notes:
- In my case, it is not permissible to allow the user to enter “123.45” and then round it to “123” on the server if I need an integer.
- There is no check on the client side, so if the user enters the wrong value type, the page will return with a descriptive error message in the field.
- The inputs cannot be
type="number" due to the controls inserted by the browser.
source share