Closed patwid closed 4 weeks ago
Hi there, when you say "doesn't work properly" can you clarify whether you mean "the HTML is not what I expect" vs "the behaviour is not what I expect".
attribute.readonly
sets a property on the element without modifying the html. You can read about the difference between attributes and properties here.
If the behaviour is what you expect (eg the input cannot be modified) then I will close this because it's working as intended!
The behavior is not what I expect. The input element still accepts input.
I assumed that setting the property would also modify the DOM/html, because I compared it to attribute.disabled(True)
for which the behavior is as expected. And there the input element actually has the "attribute" disabled
in the DOM/html.
Similar to the resolved issue #55, specifying the boolean property
readonly
does not seem to be applied to e.g. an input element.Specifying the boolean property
disabled
seems to work properly.For example:
As a workaround, specifying "readonly" as an attribute rather than a property seems to work as expected: