1 $(document).ready(function() {
2 $("#branch").on("change", function() {
3 var selectedBranch = $("#branch").children(
4 "option:selected").val();
6 $("#register_id").children().each(function() {
7 // default to no-register
8 if ($(this).is("#noregister")) {
9 $(this).prop("selected", true)
11 // display branch registers
12 else if ($(this).hasClass(selectedBranch)) {
13 $(this).prop("disabled", false);
15 // default to branch default if there is one
16 if ($(this).hasClass("default")) {
17 $(this).prop("selected", true)
20 // hide non-branch registers
23 $(this).prop("disabled", true);