I’m a Javascript novice, just playing around with Velo, and I’m trying to associate one page element with another. So, for example, if Element A is a text heading and Element B is a text body, I’d like Element A to have a field for its text body or vice-versa. My understanding of Javascript is that anything can be added to anything, so this aught to be as simple as doing ElementA[body] = ElementB and calling it a day. But this doesn’t seem to be working. Here’s my implementation:
$w. onReady(LetsGo);
let heading;
function LetsGo() {
heading = $w('#PastHeading');
heading .body = $w('#PastBody');
console .log(pastHead. body .id);
}
export function expand_something(event) {
console. log(event .target. body);
}
The result is that the console output in LetsGo() corrects outputs “PastBody”, but the console output in expand_something() (triggered by a mouse click on the heading element) outputs “undefined.” Obviously I’m missing something. What am I missing? Any help is appreciated.
-Aidan