From fe0411e8df4c8e6b75051f27f06aaf0071e3a527 Mon Sep 17 00:00:00 2001 From: Stephen McQuay Date: Tue, 5 Mar 2013 23:53:22 -0800 Subject: [PATCH] picking off names/values of buttons (there must be a better way) --- static/allowances.js | 7 ++++++- templates/index.html | 10 +++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/static/allowances.js b/static/allowances.js index 33bf1a0..42e9f2c 100644 --- a/static/allowances.js +++ b/static/allowances.js @@ -1,6 +1,11 @@ $(function() { $(".controls").hide(); - $(".name").click(function(e) { + $(".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); + }); }); diff --git a/templates/index.html b/templates/index.html index a4c0ab9..81717c9 100644 --- a/templates/index.html +++ b/templates/index.html @@ -16,13 +16,9 @@ {{ range .children }} - - - {{ .Name }} - - - {{ dollarize .Money }} - + + {{ .Name }} + {{ dollarize .Money }}