Save value to an input after inserting it automatically using Javascript

1

I have a select box that defines how many items are going to be displayed to the user.

link

However, when it fails to fill one of the inputs, it displays the error: "undefined" If it fills the 5 fields, they work fine, the problem is when the user chooses less field.

How do I collect the value of the inputs and not display this error?

    
asked by anonymous 07.12.2016 / 12:31

1 answer

2

Instead of using multiple variables to fill in the result, you can fill only one containing the text, and verify that the input is valid.

JSFiddle : link

    
07.12.2016 / 13:54