简体   繁体   中英

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>

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
        }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM