I have the following code.
<select id="cage_options"> <option>Please select</option> <option value="2,63330">option1</option> <option value="3,13300">option2</option> <option value="4,2000.00">option3</option> </select> <input id="cage_labor_estimate" disabled> <script> function format(n) { return n.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,"); } document.getElementById("cage_options").addEventListener("change", cageOptionFunction); function cageOptionFunction() { select=document.getElementById('cage_options').value.split(','); cage_option = select[1]; document.getElementById("cage_labor_estimate").value = format(cage_option); } </script> I am trying to format the output in the disabled input box in a current format but get the following error:
TypeError: n.toFixed is not a function. (In 'n.toFixed(2)', 'n.toFixed' is undefined)
Can anyone help?
Thanks,
John