I\'m trying to reorganize my code and make it more unobstrusive.
Mainly, there is a link for performing an action. If you click on the link, the action is performed via
Just demonstrating the use of .end() for a more fluid solution:
$(function() {
$(".add2").click(function(){
return $(this).parents(".place")
.find(".add2")
.hide()
.end()
.find(".actions")
.append("Added! Undo");
});
$('.undoadd2').live('click', function(){
return $(this).parents(".place")
.find(".actions")
.find("span.added, a.undoadd2")
.remove()
.end()
.end()
.find(".add2")
.show();
});
});