Permalink
Browse files

Initial, useless really, but you know

  • Loading branch information...
1 parent 69e7cce commit c791115dec1310a140260c8749878794da6b025d Jeff Johnson committed Mar 14, 2013
Showing with 44 additions and 0 deletions.
  1. +17 −0 jquery.moneyfield.coffee
  2. +27 −0 jquery.moneyfield.html
@@ -0,0 +1,17 @@
+$ = jQuery
+value_field_selector = "[data-money-field]"
+
+$.fn.extend \
+ moneyfield: ->
+ $(this).keyup update_value_field
+
+
+get_value_field = ->
+ $(this).parent().find(value_field_selector)
+
+convert_input_to_actual = ->
+ $(this).val()
+
+update_value_field = ->
+ $val = get_value_field.apply(this)
+ $val.val(convert_input_to_actual.apply(this))
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+ <head>
+ <title>jquery.moneyfield - get money, get paid</title>
+
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"> </script>
+ <!-- Now this is us right here -->
+ <script src="jquery.moneyfield.js"> </script>
+
+ </head>
+
+ <body>
+ <h1>jquery.moneyfield</h1>
+ <p>jquery-money-field helps you get paid.</p>
+
+
+ <div class="example">
+ <input id="example1" type="text">
+ <input type="hidden" name="example" data-money-field>
+ </div>
+ <script>
+ $(function() {
+ $('#example1').moneyfield();
+ });
+ </script>
+
+ </body>
+</html>

0 comments on commit c791115

Please sign in to comment.