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

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

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -