Well, first of all try to do it like in this example here…
$w.onReady(()=>{
$w("Button").onClick((event) => {
let clickedButton = event.target
console.log(clickedButton)
});
});
This will save you a lot of CODE-LINES ![]()
Expand the code…
$w.onReady(()=>{
$w("Button").onClick((event) => {
let clickedButton = event.target
console.log(clickedButton)
console.log(clickedButton.subString(0,8))
if(clickedButton.subString(0,8)==="readMore") {console.log("More-Button clicked")}
else if(clickedButton.subString(0,8)==="readLess") {console.log("Less-Button clicked")}
else { }
});
});
If targeting do not work, then modify this line…
let clickedButton = event.target
to…
let clickedButton = event.target.id