2 way data binding in JavaScript

后端 未结 5 2203
栀梦
栀梦 2020-12-18 09:11

Two-way data binding refers to the ability to bind changes to an object’s properties to changes in the UI, and vice-versa.

Can we achieve 2-way data-binding with Jav

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-18 10:00

    Yes indeed. There are frameworks like angular Js which provides full support for two way data binding. And if you want to achieve the same in vanilla js you can bind value into view

    Eg. document.getElementById('test').value="This is a Test"
    

    And to bind view value to the controller you can trigger onchange event in html.

     
    

提交回复
热议问题