DOM Manipulation - Lowering opacity of button not working

Hello! I don’t know if this is the right area to submit it, but I’ve had positive interactions here and wondered if this was the right place to ask for help.
Part of this challenge is to set the reset button to a lower opacity (and overall preventing the user from clicking) when the inputs are empty. However, right now I’m having trouble with the first step of the process!
I’m still quite new to JS and DOM Manipulation, so I know this is probably incredibly silly for me to ask.

I’ve made a Codepen with all the code. As I feel as if I put all the code and general HTML/CSS markup here, it’ll be a huge mess.

Thank you to anyone who will reply. :slight_smile:

function checkEmptyInputs() {
    let isEmpty = false;

    inputs.forEach(input => {
        if (input.value === "") {
            isEmpty = true;
        }
    });
    
    if (isEmpty) {
        resetBtn.style.opacity = 0.5;
    } else {
        resetBtn.style.opacity = 1;
    }
} 

I would rethink this logic. Right now, if just one input is empty then isEmpty will be true. Are you sure that’s what you want?

Thank you! I will rethink it. I’ll probably do some more studying into this sort of thing just so I can wrap my head around this. It’s been a long while since I’ve done any sort of JS studying, so I think that’s definitely overdue!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.