javascript - numbers and text in same field -


i can't numbers , text in same form field force 2 decimal places or total figure.

this link.

i trying last 3 cells work 2 decimal places. e.g. total sq mt figure x price should calculate cost cell.

also want cost cell (nan) working ! thanks.

in general, want this

function calc(val1, val2) { // not replacement calculate function     val1 = parsefloat(val1.replace(/[^\d\.-]/g, ''));     val2 = parsefloat(val2.replace(/[^\d\.-]/g, ''));     return (val1 * val2).tofixed(2); } 

note: above returns string

and stop redefining math.round in code


Comments