I have a table that looks like this :
<table style="width:100%">
<tr>
<th style="max-width:150px; min-width:150px; width:150px;"> </th>
<th style="max-width:150px; min-width:150px; width:150px;">Senin</th>
<th style="max-width:150px; min-width:150px; width:150px;">Selasa</th>
<th style="max-width:150px; min-width:150px; width:150px;">Rabu</th>
<th style="max-width:150px; min-width:150px; width:150px;">Kamis</th>
<th style="max-width:150px; min-width:150px; width:150px;">Jumat</th>
</tr>
<tr>
<th style="max-width:150px; min-width:150px; width:150px;">06.00 - 07.00</th>
<?php if ($senin06 == "-") {$kelas = "kosong";} else {$kelas = "biasa";}
echo "<td style='max-width:150px; min-width:150px; width:150px;' class='$kelas'>"; echo $senin06; "</td>"; ?>
<?php if ($selasa06 == "-") {$kelas = "kosong";} else {$kelas = "biasa";}
echo "<td style='max-width:150px; min-width:150px; width:150px;' class='$kelas'>"; echo $selasa06; "</td>"; ?>
<?php if ($rabu06 == "-") {$kelas = "kosong";} else {$kelas = "biasa";}
echo "<td style='max-width:150px; min-width:150px; width:150px;' class='$kelas'>"; echo $rabu06; "</td>"; ?>
<?php if ($kamis06 == "-") {$kelas = "kosong";} else {$kelas = "biasa";}
echo "<td style='max-width:150px; min-width:150px; width:150px;' class='$kelas'>"; echo $kamis06; "</td>"; ?>
<?php if ($jumat06 == "-") {$kelas = "kosong";} else {$kelas = "biasa";}
echo "<td style='max-width:150px; min-width:150px; width:150px;' class='$kelas'>"; echo $jumat06; "</td>"; ?>
</tr>
<tr>
<th style="max-width:150px; min-width:150px; width:150px;">07.00 - 08.00</th>
<?php if ($senin07 == "-") {$kelas = "kosong";} else {$kelas = "biasa";}
echo "<td style='max-width:150px; min-width:150px; width:150px;' class='$kelas'>"; echo $senin07; "</td>"; ?>
<?php if ($selasa07 == "-") {$kelas = "kosong";} else {$kelas = "biasa";}
echo "<td style='max-width:150px; min-width:150px; width:150px;' class='$kelas'>"; echo $selasa07; "</td>"; ?>
<?php if ($rabu07 == "-") {$kelas = "kosong";} else {$kelas = "biasa";}
echo "<td style='max-width:150px; min-width:150px; width:150px;' class='$kelas'>"; echo $rabu07; "</td>"; ?>
<?php if ($kamis07 == "-") {$kelas = "kosong";} else {$kelas = "biasa";}
echo "<td style='max-width:150px; min-width:150px; width:150px;' class='$kelas'>"; echo $kamis07; "</td>"; ?>
<?php if ($jumat07 == "-") {$kelas = "kosong";} else {$kelas = "biasa";}
echo "<td style='max-width:150px; min-width:150px; width:150px;' class='$kelas'>"; echo $jumat07; "</td>"; ?>
</tr>
</table>
I want to change the value inside the td element when the user double click on it. The table contain variables that connected to PHPMyAdmin
, any idea how to do it?
2
Answers
This code is horrible… but I think you may a beginner.
So, here is my answer:
NOTE:
I’m not sure I got it right, but I think you want this
Use “ondblclick” Event