$results = DB::query("SELECT * FROM tblDevices");
foreach($results as $row) {
echo "<tr>";
echo "<td>" . "" . $row['DeviceName'] . "</td>";
echo "<td>" . "" . $row['DeviceArea'] . "</td>";
echo "<td>" ."" . $row['DeviceType'] . "</td>";
//echo "<td>" . "<span id='device" . $row['DeviceID'] . "'> " . $row['DeviceState'] . "</span></td>";
echo "<td>" . "<input id='stateToggle" . $row['DeviceID'] . "'type='checkbox' class='custom-control-input'";
if ($row['DeviceState'] == 1)
{
echo " checked ";
}
echo "onclick='turnOn(\"" . $row['DeviceID'] . "\")' name='DeviceToggle'>";
echo "</td>" . "</tr></tbody>";
}
I can't figure out why my toggle isn't showing up at all in the table. If I remove the class the makes it into a toggle it works fine as a checkbox (running the function etc.)
I used the above website as another attempt, it shows the toggle but doesn't run the function at all
<input type="checkbox" checked data-toggle="toggle">
Any help would be appreciated
Aucun commentaire:
Enregistrer un commentaire