Sha256: 5ff7cf1f70aa4642c9d92e7b732cd0798c86caca7fca19c9024c47ad821a6905

Contents?: true

Size: 554 Bytes

Versions: 1

Compression:

Stored size: 554 Bytes

Contents

$(document).on 'change', "select[data-behavior='address-country']", (event) ->
  country_code = $(this).val()

  url = "/effective/address/subregions/#{country_code}"
  state_select = $(this).parent().parent().find("li > select[data-behavior='address-state']").first()

  if country_code.length == 0
    state_select.attr('disabled', 'disabled')
    state_select.html('<option value="">please select a country</option>')
  else
    state_select.removeAttr('disabled')
    state_select.find('option').first().text('loading...')
    state_select.load(url)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
effective_addresses-0.1 app/assets/javascripts/effective_addresses/address_fields.js.coffee