- Mastering Reactive JavaScript
- Erich de Souza Oliveira
- 62字
- 2021-07-09 20:33:09
Subscribing using the assign method
The assign() method lets you call a function on an object every time an event occurs. It is especially useful to set the content of DOM elements. You can use it to set the value of a DOM object class using jQuery:
observable
.assign($("#myElement"), "class");
The assign() method is just a synonym for the onValue() method.