diff --git a/interface/new/new_comprehensive.php b/interface/new/new_comprehensive.php
index ec2b9df4359..ae7255f2bec 100644
--- a/interface/new/new_comprehensive.php
+++ b/interface/new/new_comprehensive.php
@@ -637,7 +637,7 @@ function end_group()
?>
-
+
diff --git a/interface/patient_file/summary/demographics_full.php b/interface/patient_file/summary/demographics_full.php
index 0490e3e6b95..594f9f8460c 100644
--- a/interface/patient_file/summary/demographics_full.php
+++ b/interface/patient_file/summary/demographics_full.php
@@ -340,18 +340,15 @@ function InsSaveClose() {
}
// The ins_search.php window calls this to set the selected insurance.
function set_insurance(ins_id, ins_name) {
- var thesel = document.forms[0]['i' + insurance_index + 'provider'];
- var theopts = thesel.options; // the array of Option objects
- var i = 0;
- for (; i < theopts.length; ++i) {
- if (theopts[i].value == ins_id) {
- theopts[i].selected = true;
- return;
- }
- }
- // no matching option was found so create one, append it to the
- // end of the list, and select it.
- theopts[i] = new Option(ins_name, ins_id, false, true);
+ thesel = $('#i' + insurance_index + 'provider');
+ if ($(thesel).find("option[value='" + ins_id + "']").length) {
+ thesel.val(ins_id).trigger('change');
+ } else {
+ // no matching option was found so create one, append it to the
+ // end of the list, and select it.
+ let newOption = new Option(ins_name, ins_id, true, true);
+ thesel.append(newOption).trigger('change');
+ }
}
// This capitalizes the first letter of each word in the passed input
@@ -637,7 +634,7 @@ function validate(f) {