Unable to catch ID [Solved]

I placed an ID in a “ID attribute” box. Then, I ran the following script and tried to catch the ID in the console.

But I failed. Why?

Hi @rio,

The “a” argument in your code snippet is referencing a variable by that name (which doesn’t exist). If you actually typed the letter “a” into the ID Attribute field, then you’d need to put quotes around the “a” in your JS code.


Thanks @sudsy !
I missed “a” very basic thing.

1 Like

For those still having the “Uncaught ID” issue, dynamic ID might do the job right.

Dynamic ID has prevented a script slippage for me.

For those having uncaught Id yet, setting timeout event might be the last resort.
setTimeout(() => {YOUR CODE}, 1000)

This topic was automatically closed after 14 days. New replies are no longer allowed.