"text" property

I think it would be good if the DOM elements "input" and "textarea" had the property "text". This property would have the same meaning as "value". Means it will change the contents of the "input" or "textarea".

document.getElementsByTagName("textarea")[0].value = "This text is displayed in the textbox";
document.getElementsByTagName("textarea")[0].text = "Now another text is displayed in the textbox";

Why add the new property? "text" sounds much more natural to human beings than some "value". What value, why value? When we work with text we refer to it as text, not like some "value". I sometimes find myself typing "document.getElementsByTagName('textarea')[0].text = '...'" and then wondering why it is not working.

(of course we keep the "value" property as well for backward compatibility)

Hi @jaroslav.tavgen

DOM level changes are better discussed in other forums such as WHATWG ยท GitHub

This discourse is more for the core language.

1 Like