以下、 'plus'クラスをクリックすると、すべての非表示行が表示されます。別のクラスがクリックされたときにクラスを削除/追加する方法は?
デフォルトでは非表示になっています。
特定の年がクリックされたときにどうすればその年の月が表示されますか。
以下のコードをクリックすると、すべて表示されます。
<cfoutput query="getdates" group="year">
<thead>
<tr>
<th> <span class="plus">+</span> #year#</th>
</tr>
</thead>
<cfif dtToday gte combineDates>
<tbody class="closeAction">
<cfoutput>
<tr>
<td><a href=""> #month# </a></td>
</tr>
</cfoutput>
</tbody>
</cfif>
</cfoutput>
<style>
.closeAction {
display: none;
}
</style>
<script>
$(".plus").click(function() {
//$('.plus',this).html('-');
$(".closeAction").removeClass("closeAction");
})
</script>
これは、クリックする前にどのように見えるかです:
複数の日付を示す最終的なHTMLをもう少し分かち合うことができたら、自分の答えを私が提供したものよりも良くなるように整理することができます。 – AtheistP3ace