Apparently there are tag attributes (value, name, etc) that are always coming back as undefined, even though in the same log session capturing the element directly shows they're defined (and hardcoded mind you)?

Ive rewritten the plugin im trying to complete a couple times now because like Im thinking this is a problem with my business logic or whatever but it all boils back to this, just like it did yesterday before the rewrites. One rationalization is that maybe it’s that the value attributes arent apart of an actual form request and Im just event listening clicks with what I want to do with the values, but that doesnt add up either because ive done the same before in different attempts with other things, thats not how it worked then.

Im embarrassed to ask over something this basic tbh

Instead of your line

document.querySelector('.small').value

(which returns undefined)

You can use

document.querySelector('.small').getAttribute('value')

(which returns the value you are expecting)

As you have discovered, the attribute, for whatever reason, is not reflected to the property.

Philip

Why would you expect node element to have a .value property? It’s just not there. Neither Node nor Element nor HTMLElement have value or name :thinking: What @philipbuckley suggested would be the correct way to get attributes

@Karmalakas Edit fiddle - JSFiddle - Code Playground

Thank you I appreciate your time & attention

That’s a bit strange. Maybe browsers do support it, but it seems it’s not to specs. IDK :man_shrugging: