Skip to content

Commit

Permalink
Fix the add attribute select in ie 10/11
Browse files Browse the repository at this point in the history
Prior to this change, the select did not work because the event handler used the selectedOptions property, which does not work in IE (see: https://caniuse.com/?search=selectedoptions).

This change reworks the code to use the value and select the correct option from there.  All of that code is compatible with IE10/11 and modern browsers.
  • Loading branch information
Koen Cornelis committed Sep 2, 2021
1 parent e73e772 commit 5a38e3c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mujina-idp/src/main/resources/public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ document.addEventListener("DOMContentLoaded", function () {
});

document.querySelector(".attribute-select").addEventListener("change", function (e) {
var selectedOption = e.target.selectedOptions[0];
var val = selectedOption.value;
var val = e.target.value;
var selectedOption = document.querySelector('option[value="' + val + '"]');
var text = selectedOption.text;
var multiplicity = selectedOption.dataset.multiplicity === "true";
var newElement = document.createElement("li");
Expand Down

0 comments on commit 5a38e3c

Please sign in to comment.