JIT
Dropdown selection updates table row text value
when newtourneynamedropdown selected, give nearest newtourneynumparticipantselect text value from newtourneynamedropdown text const row = ` <tr> <td class="rankplayer"> ${user.name} <span class="icon"><i class="fa-solid fa-circle-plus btn_row_below_new"></i></span> <span class="icon"><i class="fa-regular fa-pen-to-square btn_row_below_update"></i></span> </td> <td class="rankcount">${count}</td> <td class="rankpoint">${points}</td> <td class="rankid" style="visibility: collapse;">${user.ID}</td> </tr> <tr class="newrank" style="visibility: collapse;"> <td colspan="4" > <table> <tr> <td class="newrankidid" style="visibility: collapse;">${user.ID}</td> <td> <table> <tr> <td> <table> <tr class="newranknamenew"> <td> <span class="icon"><i class="fa-solid fa-circle-xmark"></i></span> </td> </tr> <tr class="newranknameselect active"> <td> <span class="icon"><i class="fa-solid fa-keyboard"></i></span> </td> </tr> </table> </td> <td> <table> <tr class="newranknamenew"> <td> <input type="text" class="newtourneyname" placeholder="Tourney Name" required> <input type="number" class="newtourneynumparticipantnew" placeholder="Number Participant" min="1" required> </td> </tr> <tr class="newranknameselect active"> <td> <label for="newtourneynamedropdown" >Tourney name:</label> <select class="newtourneynamedropdown" name="newtourneynamedropdown" > <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="fiat">Fiat</option> <option value="audi">Audi</option> </select> <input type="number" class="newtourneynumparticipantselect" placeholder="Number Participant" disabled> </td> </tr> </table> </td> </tr> </table> <td> <td><input type="number" class="newrank" placeholder="Rank" required></td> <td><input type="number" class="newpoints" placeholder="Points" required></td> <td class="newsubmit"> <span class="icon"><i class="fa-solid fa-circle-plus btn_row_new_submit"></i></span> <label class="newsubmitstatus" style="visibility: hidden;">Status</label> </td> </tr> </table> </td> </tr> ${playerEvents.map(pe => ` <tr class="updaterank" style="visibility: collapse;"> <td colspan="6" > <table> <tr> <td class="updaterankidid" style="visibility: collapse;">${pe.users_id}</td> <td class="updaterankeventid" style="visibility: collapse;">${pe.event_id}</td> <td> Tourney Name : <input type="text" class="updatetourneyname" placeholder="Tourney Name" value="${pe.tourneyname}" required> </td> <td> Rank : <input type="number" class="updaterank" placeholder="Rank" value="${pe.rank}" required> </td> <td> Points : <input type="number" class="updatepoints" placeholder="Points" value="${pe.points}" required> </td> <td class="updatesubmit"> <span class="icon"><i class="fa-regular fa-pen-to-square btn_row_update_submit"></i></span> <label class="updatesubmitstatus" style="visibility: hidden;">Status</label> </td> </tr> </table> </td> </tr> `).join('')} `; tbody.insertAdjacentHTML('beforeend', row);
Updated files
v1