var tag = this; tag.common = choices.common_currency; tag.currency = choices.currency; tag.on('before-mount', function(){ tag.amount = tag.opts.amount; tag.chosen = tag.opts.chosen; tag.defaultCurrency = tag.opts.defaultCurrency || 'USD'; tag.placeholder = tag.opts.placeholder || 'Pick a currency'; tag.valuePlaceholder = tag.opts.valuePlaceholder || 'Amount'; }) tag.selectChoice = function(e){ e.preventDefault(); tag.chosen = e.item.choice; /* And bubble up - just the currency code - to parent */ tag.parent.trigger('setCurrency', tag.chosen[0]) } tag.setAmount = function(e){ tag.parent.trigger('setAmount', e.target.value) }