30 lines
841 B
JavaScript
30 lines
841 B
JavaScript
let colCount = 1;
|
|
function addForm(){
|
|
console.log('et');
|
|
|
|
let col = $("#col_add_Kalori")
|
|
|
|
let html = '';
|
|
|
|
html += `
|
|
<div class="col mt-2 d-flex align-items-start gap-2" id="col-${colCount}">
|
|
<div class="form-floating flex-grow-1">
|
|
<input type="text" class="form-control" name="data[${colCount}][nilai_kalori]" placeholder="exp : 1000" required>
|
|
<label>Nilai Kalori</label>
|
|
</div>
|
|
<div class="invalid-feedback"></div>
|
|
|
|
<button type="button" class="btn btn-danger mt-2 me-2" onclick="removeCol(${colCount})"><i class="fa-solid fa-trash"></i></button>
|
|
</div>
|
|
`
|
|
col.append(html)
|
|
colCount++;
|
|
|
|
}
|
|
|
|
|
|
function removeCol(count){
|
|
$(`#col-${count}`).remove()
|
|
}
|
|
|