javascript - save data with a dynamic row script inside mysql -
i know how save data dynamic row script in multilanguage approach in mysql database. element below create new empty row every time click on input. input can deleted. don't know best approach , if ideas, cool
thank you
$content .= ' <div class="form-group form-group-options col-md-8"> '; ($i=0, $n=sizeof($languages); $i<$n; $i++) { $content .= ' <div class="col-md-12"> <div class="form-group row"> <div class="input-group input-group-option"> <label for="lang" class="col-1 col-form-label">' . $oscom_language->getimage($languages[$i]['code']) . '</label> ' . html::inputfield('user_question[][' . $languages[$i]['id'] . ']', null, 'placeholder="write question"') . ' <span class="input-group-addon input-group-addon-remove"> <span>x</span> </span> </div> </div> </div> '; } ?> </div>
and javascript
<script> $(function(){ $(document).on('focus', 'div.form-group-options div.input-group-option:last-child input', function(){ var sinputgrouphtml = $(this).parent().html(); var sinputgroupclasses = $(this).parent().attr('class'); $(this).parent().parent().append('<div class="'+sinputgroupclasses+'">'+sinputgrouphtml+'</div>'); }); $(document).on('click', 'div.form-group-options .input-group-addon-remove', function(){ $(this).parent().remove(); }); }); </script>
Comments
Post a Comment