3
I have the following HTML code:
<table class="al-center" style="width: 520px;">
<tr>
<td>
<div class='form-group'>
<label class='control-label' for='auto'>RECEBIDO POR*</label>
<input type='text' class='autofocus form_campos form_campos_simples' id='auto' name='verifica_nome'>
<input name='cliente' type='hidden'>
</div>
<div class='form-group'>
<label class='control-label' for='qtd'>QTD*</label>
<input type='text' class='form_campos form_campos_ddd' id='qtd' name='qtd'>
</div>
</td>
</tr>
</table>
I need to put it inside a Javascript variable, which is inside this code:
<script>
$('input[name="qtd"]').on('keyup click', function(){
var qtd = $(this).val();
if(qtd > 0) {
$('#inputs table').remove();
var appending = '<table class="al-center" style="width: 520px;">';
for(var i = 1; i <= qtd; i++) {
appending += 'Tenho que por ele aqui';
}
appending += '</table>';
$('#inputs').append(appending);
}else {
$('#inputs table').remove();
}
});
</script>
It works if I put everything on a line, the problem is complicated for me to maintain and understand the code.
How to indent HTML?
What parts of that code you need to maintain/modify?
– Sergio