I am receiving a True/False statement called favIcon, that is responsible for a button state. This button toggles from "active to "disabled", and behaves similar to a "facebook like button": on page load, if favIcon is true it shows the button "Active".
First thing I am trying to do is to console.log the favState condition with an If statement. Current attempt looks like this (this is my reference):
var favIcon = true;
function onload(){
if(favIcon == true){
console.log ("active");
}
else {
console.log ("disabled");
}}
I didn't manage to make it work, and once I have this response, it will allow me to go to the next step:
if favIcon == true, button state is active
if favIcon == false, button state is disabled
Now the button goes from disabled to active (I managed to make something to work!) (used this for ref)
<input id="button" type="button" value="disabled">
<script>
$('#button').click(function() {
$(this).val('active');
});
</script>
Hopefully I was clear enough. Thank you all.