$(function() { $(".controls").hide(); $(".child").click(function(e) { $(this).next(".controls").toggle(); }); $(".btn").click(function(e) { var amount = $(this)[0].value; var name = $(this).parent().parent().parent().prev().find(".name").text(); console.log(name + " " + amount); }); });