I’m new in javascript. I try to make the badge color change according to the value. I’ve tried but the output is error badge
<th>
<select class="select2-placeholder form-control" id="sIsLocked">
<option value="">Pilih</option>
<option value="false">Un Locked</option>
<option value="true">Locked</option>
</select>
</th>`your text`
render: function (data, type, row, meta) {
switch (data) {
case false:
return '<span class="badge bg-success">Un Locked</span>';
case true:
return '<span class="badge rounded-pill bg-secondary">Locked</span>';
default:
return '<span class="badge badge-danger badge-pill">Error!</span>';
}
}