class TestVerifyForm { constructor() { this.$invoiceAmountField = $("#invoice-amount"); this.$newTestProjectField = $("#new-test-project-id"); this.$newTestProjectField.on("change", event => { const $option = this.$newTestProjectField.find("option:selected"); const customerFee = $option.attr("data-customer-fee"); this.$invoiceAmountField.val(customerFee); }); } } $(() => new TestVerifyForm());