javascript - Dynamic text field after select combo box data (codeigniter) -


i want make dynamic text field named holiday after 1 of data @ combo box has selected.

the column display @ combo box problem. example have 5 problems a, b, c, d, e.

when select problem on combo box, form edit display dynamic text field name holiday without reload page. but, if select b, c, d, e, doesn`t display. problem have dynamic text field.

so, how can solve problem? code controller, model, , view on codeigniter?

can try code bellow:

html

<select id="combo" name="combo">     <option value=""></option>     <option value="a">a problem</option>     <option value="b">b problem</option>     <option value="c">c problem</option>     <option value="d">d problem</option>     <option value="e">e problem</option> </select> 

javascript:

$(document).ready(function(){     $("#combo").change(function(){         var $combovalue = $(this).val();         if($combovalue == "a"){              //dynamically create textbox             var $template = "<input type='text' name='holyday' id='holyday' placeholder='holyday' />";              $(this).parent().append($template);         } else {             $("#holyday").remove();            }     }); }); 

here fiddle live preview

regards


Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

php - Improving script execution time -

How to provide Authorization & Authentication using Asp.net, C#? -