This is probably a super dumb question that has a facepalm answer, but I can’t figure out what’s happening (after extensive internet searches) and it’s driving me crazy. So I have two buttons on top of each other: a “read more” button and a “read less” button that’s collapsed on load. In the editor, they’re both in the exact same place, centered on the page, below a repeater. Then I have a code to click the “read more” button to see everything in the data set for the repeater, make that button disappear, and then make the “read less” button appear. The code works fine when I enter preview mode, but for some reason, when I go back to the editor, the "read less button is now all the way to the left of the page?? The “read more” button is still where it’s supposed to be, so I have no idea what’s happening to the “read less” button. Again, this is probably a dumb question and also might be more of an editor question than a Corvid question, but I appreciate any help.
Instead of having two buttons, I originally was hoping to change the text/icon of the button when I clicked on it, but I couldn’t figure out how to do that (again, after extensive internet searches). So if you know how to do that, help with that would be even cooler.
Here’s the code I have, in case it has something to do with that. TIA!
$w.onReady(function () {
$w("#readMoreButton").onClick(() => {
var numNews = $w("#dataset1").getTotalCount();
$w('#dataset1').setPageSize(numNews);
$w('#readMoreButton').collapse()
$w('#readLessButton').expand()
});
$w("#readLessButton").onClick(() => {
$w('#dataset1').setPageSize(5);
$w('#readLessButton').collapse()
$w('#readMoreButton').expand()
});
});