i want to change button colour and text on on click and it should not change when page is refreshed.Here when set status is clicked it changes the text to confirmed and colour changes to green,when i again click on it,it changes the colour to red and text changes to pending.Now when i again click on it,it should change the colour to green and text should change to confirmed,here neither the color changes nor the text is changed.And this should stay when page is refreshed. here is the code:
<input type="submit" id="<?php echo $orderQuery['id'];?>" value="set status" onclick="setColor('<?php echo $orderQuery['id'];?>')"; />
<script>
var count = 1;
function setColor(btn) {
var property = document.getElementById(btn);
if (count == 0) {property.style.backgroundColor = "#ff0000"
if (property.value=="confirmed") property.value = "pending";
}
else {property.style.backgroundColor = "#7FFF00"
count = 0;
if (property.value=="set status") property.value = "confirmed";
}
}
</script>