Skip to content

Instantly share code, notes, and snippets.

@omnikron
Created June 25, 2013 14:30
Show Gist options
  • Save omnikron/5858909 to your computer and use it in GitHub Desktop.
Save omnikron/5858909 to your computer and use it in GitHub Desktop.
jQuery - live update while typing (just like Angular)
# Show euro total when editing account payment plans
$(".input .integer[id^='account_payment_plans_attributes']").each ->
value = $(@).attr('value') / 100 / 1000
$(@).parent().next('.euros').html(" = €#{$(@).attr('value') / 100 / 1000 }")
$(".input .integer[id^='account_payment_plans_attributes']").on 'keyup', ->
$(@).parent().next('.euros').html(" = €#{$(@).attr('value') / 100 / 1000 }")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment