Skip to content

Instantly share code, notes, and snippets.

@jongrover
Created August 20, 2013 17:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jongrover/6284483 to your computer and use it in GitHub Desktop.
Save jongrover/6284483 to your computer and use it in GitHub Desktop.
JavaScript Procedural ATM Lab part 2 - Starting Code
<h1>ATM</h1>
<form id="atm" action="#" method="post">
<select name="choice" id="choice">
<option selected>-- select choice --</option>
<option value="deposit">deposit</option>
<option value="withdrawal">withdrawal</option>
</select>
<input type="text" id="amount" name="amount" placeholder="amount">
<input id="submit" type="submit" value="submit">
</form>
<p id="balance">balance: $0.0</p>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(function() {
/* ATM Lab (part 2) - Directions
1. set initial balance
2. on form submission gather the users choice from the select menu
3. run the appropriate transaction based on the users choice.
4. tell the user their new balance after deposit or withdrawal.
5. Bonus: style the select menu to trigger showing and hiding the amount input and submit button depending on if they are needed for the selection.
Things to Know (Hints)
variables
functions
conditional statements
parseFloat()
isNaN()
jQuery().val()
jQuery().submit()
jQuery().change()
jQuery().text()
jQuery().show()
jQuery().hide()
*/
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment