Hend Mourad
Hend Mourad

Reputation: 55

Auto Generate HTML Text inputs based on selection value

i have a selection with 3 options values . i want to auto generate html input based on selection if user select 2 it show to him two text inputs with same id for both shown.

<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>

Upvotes: 0

Views: 445

Answers (1)

Rkv88  -  Kanyan
Rkv88 - Kanyan

Reputation: 1332

try this i used jquery

https://jsfiddle.net/rkv88/grym5fqv/

On event .change() { 
hide every text input;
for loop N times   N is the option number{
      show that text element  until N index
        }
}

Upvotes: 1

Related Questions