I'm having trouble wrapping my head around this logic: I am succeeding in deleteRecipe to remove it's parents, but it is also supposed to fade in the undo button on top of it, that when clicked is supposed to fadeIn our sibling deleted Recipe. Attached is my code and If you want to see the entire code it's on fiddle:
HTML
<body>
<div class="mainContainer col-md-12 col-xs-12">
</div>
</body>
JS
var deleteRecipe = document.createElement('span');
deleteRecipe.setAttribute("class", "fa fa-times-circle", "aria-hidden", "true");
checkBoxes.appendChild(deleteRecipe);
$(deleteRecipe).click(function() {
$(this).parents('.contentContainer').fadeOut();
$(undoButton).fadeIn();
});
var undoContainer = document.createElement('div');
undoContainer.setAttribute("class", "col-md-12 col-xs-12 undoContainer");
mainContainer[0].appendChild(undoContainer);
var undoButton = document.createElement('span');
undoButton.setAttribute("class", "fa fa-undo", "aria-hidden", "true");
undoContainer.appendChild(undoButton);
$(undoButton).hide();
$(undoButton).click(function() {
$(this).siblings().fadeIn();
$(undoButton).fadeOut();
});