HTML and CSS Reference
In-Depth Information
Listing 2.7. app.js—Functions to calculate total values
We'll now look at
valueAsNumber
, a new HTML5 property that allows you to get a nu-
meric representation of the value of an input field element.
The valueAsNumber property
The
value
property of an input element like
qtyFields[i]
allows you to read the cur-
rent value of that element in JavaScript. But this value is always returned as a string. If you