Can you please help?
I get the error message saying: 'changeState" does not exist on ‘#readMoreButton’.
Following is my coding:
// API Reference: https://www.wix.com/corvid/reference
// “Hello, World!” Example: https://www.wix.com/corvid/hello-world
$w.onReady( function () {
$w( “#readMoreStateBox” ).onClick(() => {
$w( “#readMoreButton” ).changeState( “expandedState” );
});
$w( “#readMoreStateBox” ).onClick(() => {
$w( “#readLessButton” ).changeState( “collapsedState” );
}); // Write your JavaScript here
// To select an element by ID use: $w(“#elementID”)
// Click “Preview” to run your code
});
There is no onStateChange() event handler for a Button ., however you might want to consider the MultiStateBox .
See the Corvid Tutorial: Expand Text with a Read More Link which will show you how to do what you are trying to accomplish.
He’s followed that tutorial (like I have) and ended up with this issue (like I have). Did you solve it OP? I suspect neither he nor I have a deep enough understanding of the code behind what we’re doing to go beyond blindly following the tutorial.
Hi OP! the actual multi state box itself needs to be renamed as per the tutorial. Its not as obviously written that bit, but thats what causes the error we both got. Hopefully this picture will help:
See the right panel, the multi-state box is not actually called
#readMoreStatebox. all the best!