JSFiddle - React, Tailwind, and code Playground
HTML
<ol class="list">
<li><textarea></textarea><a class="add" href="#"><span>Add another</span></a></li>
<li><textarea></textarea><a class="add" href="#"><span>Add another</span></a></li>
</ol>
CSS
ol li .add {
display: none;
}
ol li:last-child .add {
display: block;
}
ol li:last-child .add span {
display: block;
animation-duration: 1s;
animation-name: slide;
}
.list li textarea {
animation-duration: 1s;
animation-name: append;
}
@keyframes append {
from {
transform: translateX(10%);
opacity: 0;
}
to {
transform: none;
opacity: 1;
}
}
@keyframes slide {
from {
transform: translateY(-100%);
}
to {
transform: none;
}
}
JavaScript
$(function(){
var row = $('<li><textarea></textarea><a class="add" href="#"><span>Add another</span></a></li>');
$('.list').on('click', '.add', function(e){
e.preventDefault();
$('.list').append(row.clone());
});
});