onchange dropdownbox in html and php? -


does knows how code form dropdown after selecting options in dropdown form display layout depending on chosen dropdown options?

for example, if choose 4 in dropdown list, form should display 4 empty textboxes, if choose 2, form display 2.

check jsbin!

given example html:

<select id='select'>   <option value="1">1</option>   <option value="2">2</option>   <option value="3">3</option>   <option value="4">4</option> </select> <input id='a' class="input" hidden></input> <input id='b' class="input" hidden></input> <input id='c' class="input" hidden></input> <input id='d' class="input" hidden></input> 

your solution this:

$('#select').change(function (evt) {   var no_inputs = $(this).val();   $('.input').each(function (i) {     $(this).hide();     if (i < no_inputs) {       $(this).show();     }   }); }); 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -