Skip to content

Commit

Permalink
form can display but update total javascript function not working
Browse files Browse the repository at this point in the history
  • Loading branch information
drewtunney committed Feb 24, 2014
1 parent badc20a commit dd823f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/users/_doge_buy_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<label>
QTY:
<input id="qty" type="integer" name="doge_total" value="1" onkeyup="updateTotal()"/>
<input id="qty" type="integer" name="doge_total" value="1" onkeyup="updatedogeTotal()"/>
</label> <br><br>

<label>
Expand Down
9 changes: 9 additions & 0 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@

document.getElementById('total').value = quantity * current_price ;
}

function updatedogeTotal(){

var quantity = document.getElementById('qty').value;
var current_price = document.getElementById('current_price').value;

document.getElementById('total').value = quantity * doge_price_btc ;
}

</script>

<%= render "btc_buy_form" %>
Expand Down

0 comments on commit dd823f9

Please sign in to comment.