I have a table and want to add a star to a cell when tag is selected. At the moment, if the below .starred is set to display block, it will show in the table as wanted. So I just need to add a class to show the star. The problem I’m having is targeting the anchor. What can I use to target the div.starred in td? tried closest() .find() .parent().find
<tr>
<td><div class="starred"></div></td>
<td>Device</td>
<td>Weight</td>
<td>Height</td>
<td>.....</td>
<td>.....</td>
<td>12/12/16</td>
<td> <select>
<option selected="true" disabled="disabled">Select</option>
<option value="offer">Make Offer</option>
<option value="counter">Counter Offer</option>
<option value="tag">Tag Record</option>
<option value="erase">Erase Record</option>
</select>
</td>
</tr>
.starred{
display:none;
width:30px;
height:30px;
background-image:url("../images/star.png");
position:relative;
background-repeat:no-repeat;
background-position: center 0;
background-size: cover;
}
.showStar{
display:block !important;
}
$('td select').on('change', function(){
var val = $(this).val();
if(val === 'tag') {
$(this).closest('.starred').addClass("showStar");
}
else if(val === '...') {
}
});