is there any way to implement easy data binding using HTML5 and Javascript?
All I want is to get the value of a text field into a Javascript object, so the following two idea came to my mind:
Add a custom attribute like data-reference to the <input>-Element which contains a reference to the Javascript object and create an event handler which actually saves the content into the object.
Is there any chance to do something like this without relying on additional frameworks?
You could do it using a different approach.
You could have a global JavaScript variable (hash) that contains a key (that's the ID of the element) and the value could be an object.
To populate that global variable you can use php's json-encode.
Bookmarks