The css you use defines the attribute. This is why changing an attribute gets a css change and setting the property does not.
I use prop because open is a property, not an attribute, right ?!
Well, it can be either depending on how you define it. Css, again, refers to an attribute.
There are several long answers explaining the differences and where to use them.
In a nutshell
Attribute is a parameter in an HTML element that binds certain data or behavior to the element. This is mainly due to the load, helping us render HTML correctly, listening that it probably made you use prop
.
A property is a characteristic of the DOM node, telling us about the current state of foo. There are special properties associated with certain types of node, some according to the standard, some according to the design of the browser. As part of the DOM, the property remains with us through the DOM manipulation, AKA Javascript.
source share