I have a checkbox that in case it's 'checked' it goes as true in the database, otherwise it's false. I want to this result appear with the checked checkbox if its true but it's not working.
CHECKBOX:
<span class="new-event-detail"><span><input type="checkbox" id="toCheck" class="addReedemButton" name="addReedemButton" value="true"/>Add Reedem Button</span></span>
GETTING DATA FROM DATABASE
let hasButton = promotions['add_button']
LOGIC:
if(hasButton == true){
console.log('true', eventName)
$("#toCheck").prop('checked',true)
$("#toCheck").attr('checked','checked')
}else{
console.log('false', eventName)
$("#toCheck").prop('checked',false)
}
None of this seems to be working, because I'm getting the result that is true or false but the checkbox is never checked.