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); }); this.$paymentRequiredField = $("#payment-required"); this.$paymentRequiredField.on("change", event => { $("#invoice-amount").closest(".row").prop("hidden", !event.currentTarget.checked); }); } } $(() => new TestVerifyForm());