From 279e891773930035761d1afdcf8967bb94d20d80 Mon Sep 17 00:00:00 2001 From: Devdatt Bhatt Date: Mon, 8 Jun 2026 04:11:06 +0000 Subject: [PATCH] update --- html/network.php | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/html/network.php b/html/network.php index 5f7fc30..7a3eb39 100755 --- a/html/network.php +++ b/html/network.php @@ -264,16 +264,25 @@ $selected_interface = $_GET['interface'] ?? array_keys($interface_data)[0] ?? nu }); // Multicast toggle switch functionality - document.querySelectorAll('.switch input[type="checkbox"]').forEach(checkbox => { - checkbox.addEventListener('change', function() { - const interfaceName = this.id.split('-')[2]; // Get interface name from ID like "multicast-eth0" - const label = document.getElementById(`multicast-label-${interfaceName}`); - - if (this.checked) { - label.textContent = 'Enabled'; - } else { - label.textContent = 'Disabled'; - } + document.addEventListener('DOMContentLoaded', function() { + // Find all multicast toggle switches + const multicastSwitches = document.querySelectorAll('.switch input[type="checkbox"]'); + + multicastSwitches.forEach(checkbox => { + checkbox.addEventListener('change', function() { + // Get the interface name from the checkbox ID + // ID format: "multicast-eth0" -> split by "-" -> [0] = "multicast", [1] = "eth0" + const interfaceName = this.id.split('-')[1]; + const label = document.getElementById(`multicast-label-${interfaceName}`); + + if (label) { + if (this.checked) { + label.textContent = 'Enabled'; + } else { + label.textContent = 'Disabled'; + } + } + }); }); });