当我单击colorCheckbox
时,我想显示colorList
,确实如此。我有两个问题。当我删除show()
并想使用切换时,什么也没发生。我还尝试添加绝对位置,以使colorList出现在标签colorCheckBox
旁边。
我在做什么错?
$('.colorCheckBox').on('click', function(e) {
$(".colorList").show();
});
<div class="colorList" style="display:none; padding: 20px;">
<a href="#" data-value="1">Grön(Godkännn)<div class="greenBox"></div></a>
<a href="#" data-value="2">Röd(Slå av)<div class="redBox"></div></a>
<a href="#" data-value="3">Gul(Kontrollera)<div class="yellowBox"></div></a>
</div>
echo "<tr id='errands-filter' class='showSearchResult' data-id='".$task['id']."'>";
echo '<td><label class="colorCheckBox">';
echo '<input type="checkbox" data-errand="'.$task['id'].'">';
echo '<div class="colorBox"></div>';
echo '</td>';
echo "<td>".$task['toDo']. ' '. $fetchName->getUserName($userResult)." </td>";
echo "<td><a href='#addInstructionsModal'class='connect_modal' data-toggle ='modal' data-target='#addInstructionsModal' data-title ='".$task['toDo']."' data-id='".$task['id']."'>Add</a> <a href='#showInstructionsModal'class='connect_modal' data-toggle ='modal' data-target='#showInstructionsModal' data-title ='".$task['toDo']."' data-id='".$task['id']."'>Visa</a> </td>";
echo "<td>".date("Y-m-d",$task['timestamp'])."</td>";
echo "<td><a class='confirm' href='addToDo.php?id=".$task['id']."'>Ta bort</a></td>";
echo "<td><i class='fas fa-arrow-left dragmark'></i></td>";
echo "</tr>";