The symptom

The code executes. Nothing crashes. And nothing you expected to happen has happened.

What's usually happening

In rough order of likelihood:

An error is being swallowed. Search your project for empty catch blocks, or catches that only log. Generated code adds these constantly, and they convert a crash you'd have fixed into silence.

The function is never called. The handler is defined but never attached, or attached to an element that didn't exist yet when the script ran.

It's operating on nothing. A selector matched zero elements, a query returned an empty list, and looping over nothing succeeds perfectly.

It's the wrong element. Two things share an ID or class, and you're changing the invisible one.

You're looking at a cached version. Hard refresh. See changes not showing up.

The fix

Prove which one it is, cheaply. Put a log as the first line inside the function. If it doesn't print, the function isn't being called and nothing else matters. If it does, log what it's working with.

silent-failure.txt
This runs with no error and no effect: <paste>

Don't suggest a fix yet. Tell me the checks, in order, that would
distinguish between: an error being swallowed, the function never
being called, it operating on an empty result, and it affecting the
wrong element.

For each check: exactly what to add, and what each result means.

Empty catch blocks are the single most common cause. Search for them before doing anything else — every one is a bug you're being prevented from seeing.