There are multiple elements, each with a unique ID "xxx_view_ch_&&&" within an outer div with the ID "xxx_view_&&&". The goal is to change the class of the element with the ID "xxx_view_ch_&&&" when the user clicks on the entire element ("xxx_view_&&&").
The current code used is as follows:
$(document).ready(function(){
$('#reci_view_01').click(function(){
$('#reci_view_ch_01').toggleClass('not_active header'); });
$('#reci_view_02').click(function(){
$('#reci_view_ch_02').toggleClass('not_active header'); });
$('#reci_view_03').click(function(){
$('#reci_view_ch_03').toggleClass('not_active header'); });
$('#reci_view_04').click(function(){
$('#reci_view_ch_04').toggleClass('not_active header'); });
$('#reci_view_05').click(function(){
$('#reci_view_ch_05').toggleClass('not_active header'); });
});
.not_active {
text-decoration: line-through !important;
color: darkgray;
font-weight: bold;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.9/semantic.min.css">
<div class="ui list">
<a id="reci_view_01" class="item">
<i class="remove circle outline icon"> </i>
<div class="content">
<div id="reci_view_ch_01" class="header">Test 1</div>
</div>
</a>
<a id="reci_view_02" class="item">
<i class="remove circle outline icon"> </i>
<div class="content">
<div id="reci_view_ch_02" class="header">Test 2</div>
</div>
</a>
<a id="reci_view_03" class="item">
<i class="remove circle outline icon"> </i>
<div class="content">
<div id="reci_view_ch_03" class="header">Test 3</div>
</div>
</a>
<a id="reci_view_04" class="item">
<i class="remove circle outline icon"></i>
<div class="content">
<div id="reci_view_ch_04" class="header">Test 4</div>
</div>
</a>
<a id="reci_view_05" class="item">
<i class="remove circle outline icon"></i>
<div class="content">
<div id="reci_view_ch_05" class="header">Test 5</div>
</div>
</a>
</div>
A task list needs to be created where users can select items to add to another list. Exploring the possibility of utilizing arrays for this functionality as JavaScript knowledge is limited.