Create javascript property like C# property

后端 未结 2 385
醉梦人生
醉梦人生 2021-02-05 21:20

Is it possible to create a property on a javascript object that behaves similar to a property in C#.

Example: I\'ve created an auto-sizing textarea widget using dojo. I

2条回答
  •  广开言路
    2021-02-05 21:42

    I'm not sure what you're asking here. You can always get the value of a textarea without the onchange event. you'd have to get the object then look at the value property.

    for example, if your textarea has an id="mytext" you can do

    var mytextarea = document.getElementById("mytext");
    var text = mytextarea.value;
    

提交回复
热议问题