diff --git a/public/v1/js/ff/accounts/create.js b/public/v1/js/ff/accounts/create.js
index 7940fe5cc7..2cc44b873f 100644
--- a/public/v1/js/ff/accounts/create.js
+++ b/public/v1/js/ff/accounts/create.js
@@ -30,4 +30,21 @@ $(document).ready(function () {
}
);
}
+ // change the 'ffInput_opening_balance' text based on the
+ // selection of the direction.
+ $("#ffInput_liability_direction").change(triggerDirection);
+ triggerDirection();
});
+
+
+function triggerDirection() {
+ let obj = $("#ffInput_liability_direction");
+ let direction = obj.val();
+ console.log('Direction is now ' + direction);
+ if('credit' === direction) {
+ $('label[for="ffInput_opening_balance"]').text(iAmOwed);
+ }
+ if('debit' === direction) {
+ $('label[for="ffInput_opening_balance"]').text(iOwe);
+ }
+}
diff --git a/resources/views/accounts/create.twig b/resources/views/accounts/create.twig
index 87bef950f5..b83bb08dcc 100644
--- a/resources/views/accounts/create.twig
+++ b/resources/views/accounts/create.twig
@@ -84,6 +84,10 @@
{% endblock %}
{% block scripts %}
+