我有添加/删除按钮的输入部分,添加额外的输入字段.我正在try 让输入区域出现一个过渡效果,而不是立即弹出.
我试着用transition
,但没用.是否有可能通过纯css来实现这一点?
代码
var i = 1;
$('#add_patient').click(function() {
i++;
$('#tbl_patient').append('<tr id="row' + i + '" class="dynamic-added">\
<td>\
<input type="text" id="patient' + i + '" name="patient" placeholder="Patient Name" required>\
</td>\
<td>\
<button class="btn_remove" type="button" name="remove" id="' + i + '">--</button>\
</td>\
</tr>');
});
$(document).on('click', '.btn_remove', function() {
var button_id = $(this).attr("id");
$('#row' + button_id + '').remove();
});
td {
transition: 0.5s ease 1s;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table id="tbl_patient">
<thead>
<tr>
<th colspan="2" class="uk-text-center">Patient</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="text" id="patient" name="patient" placeholder="Patient Name">
</td>
<td>
<button type="button" name="add_patient" id="add_patient">+</button>
</td>
</tr>
</tbody>
</table>