The linkBoth() method enables two-way data linking. The
contact object and INPUT elements are linked in both directions. When you
modify the value of the INPUT element, the contact object is also updated
For example, the following code adds a client-side
the property values of the contact object are displayed using an alert()
The following demonstrates what happens when you change the
value of the Name INPUT element and click the Save button. Notice that the name
property of the “contact” object that the INPUT element was linked to was
The above example is obviously trivially simple.
alert, you can imagine instead calling a web-service to save the object to a
database. The benefit of data linking is that it enables you to focus on your
data and frees you from the mechanics of keeping your UI and data in sync.