Save value to an input after inserting them automatically using Javascript

Asked

Viewed 19 times

1

I have a select box that defines how many items will be displayed for the user to fill.

http://jsfiddle.net/thallysondias/dsqBf/55/

However, when it stops filling in one of the inputs, it displays the error: "Undefined" If it fills in the 5 cmapos, they work well, the problem is when the user chooses less field.

How do I collect input values and not display this error?

1 answer

2


  • 1

    Thank you Lucas, it really makes a lot more sense. But I had no technical sufficiency level to do. However. There’s an error in your code that I corrected. [ if (i !== Qtd - 1) { ] when having "-1", it does not enter the last input value in the total age input, when removing it, it already works well.

  • Cool @Thallysondias. Share with me the new Fiddle update that I update in response :)

  • here is amended version: http://jsfiddle.net/thallysondias/dsqBf/59/ on line 19

  • I updated, thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.