firefly-iii/public/js/firefly.js
2015-02-06 07:23:26 +01:00

24 lines
564 B
JavaScript

$(function () {
$('.currencySelect').click(currencySelect)
});
function currencySelect(e) {
var target = $(e.target);
var symbol = target.data('symbol');
var code = target.data('code');
var id = target.data('id');
var fieldType = target.data('field');
var menu = $('.' + fieldType + 'CurrencyDropdown');
var symbolHolder = $('#' + fieldType + 'CurrentSymbol');
symbolHolder.text(symbol);
$('input[name="' + fieldType + '_currency_id"]').val(id);
// close dropdown (hack hack)
menu.click();
return false;
}