w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Enable checkbox if there is enough credit balance
for (var i =1; i <= 5; i++) {
    if(document.getElementById("star"+i).checked) {
        if(balance > 100)
            balance -= 100;
            alert("You can't afford it mate.");

This is the fix for your actual code, but it doesn't resemble the functionality that you're describing. That functionality will however simply not work with the user interface you designed (you can check the 4th box without the first 3), so you've got more problems to solve first.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.