made the class selector work

This commit is contained in:
Jesse James Isler 2022-03-31 22:10:19 +02:00
parent 6baec85d3e
commit 77cc6f6d8d

View File

@ -108,15 +108,13 @@
<option value="" disabled> Choose your option </option> <option value="" disabled> Choose your option </option>
<?php <?php
$files = glob("roles/en/*.php"); $files = glob("roles/en/*.php");
$count = 1;
foreach ($files as $filename) { foreach ($files as $filename) {
include $filename; include $filename;
$shortname = substr($filename, 9); $shortname = substr($filename, 9);
$shortname = substr($shortname, 0, -4); $shortname = substr($shortname, 0, -4);
echo "<option value=".$count.">".ucfirst($shortname)."</option>"; echo "<option value=".ucfirst($shortname).">".ucfirst($shortname)."</option>";
$count++;
} }
?> ?>
</select> </select>
@ -231,10 +229,16 @@
} }
function updateGoodRoles() { function updateGoodRoles() {
let selected = document.querySelectorAll('#tplaysbestwith option:checked'); document.getElementById("tplaysbestwith").innerHTML = "";
let goodRoles = Array.from(selected).map(el => el.value);
goodroles.forEach(element => console.log(element)); var values = $('#goodRoles').val();
// goodRoles.forEach((element) => document.getElementById("tplaysbestwith").appendchild(document.createElement("LI").appendchild(document.createTextNode(element)))); 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() { function updateDescription() {