From 77cc6f6d8d7304bfaeabd92becdd83e2e7d07264 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 31 Mar 2022 22:10:19 +0200 Subject: [PATCH] made the class selector work --- create.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/create.php b/create.php index ac39788..0a47f2f 100644 --- a/create.php +++ b/create.php @@ -108,15 +108,13 @@ ".ucfirst($shortname).""; - $count++; + echo ""; } ?> @@ -231,10 +229,16 @@ } function updateGoodRoles() { - let selected = document.querySelectorAll('#tplaysbestwith option:checked'); - let goodRoles = Array.from(selected).map(el => el.value); - goodroles.forEach(element => console.log(element)); -// goodRoles.forEach((element) => document.getElementById("tplaysbestwith").appendchild(document.createElement("LI").appendchild(document.createTextNode(element)))); + document.getElementById("tplaysbestwith").innerHTML = ""; + + var values = $('#goodRoles').val(); + for (let index = 0; index < values.length; ++index) { + const element = values[index]; + var ul = document.getElementById("tplaysbestwith"); + var li = document.createElement("li"); + li.appendChild(document.createTextNode(element)); + ul.appendChild(li); + } } function updateDescription() {