I have the following function which is called once the repeater data has been finalised. All I want to do is change some of the repeater entry content based on a setting either being a value of 1,2,3 or 4. This is to show different types of entry in a different graphical way basically.
Based on the “type”, the function will change some of the settings of the elements within the repeater entry such as colour of title etc.
I’m just testing with the following at the moment and cannot get the html.replace piece to change the text of element named #text51 (the repeater entry business name).
The change of the element #text90.text works fine.
Any ideas what I’m doing wrong?
I have included the code below along with the html content before and after the html.replace code line.
function updateontype() {
$w('#repeater3').forEachItem( ($w, itemData, index) => {
if(itemData.listingLevel == 1) {
$w('#text90').text = "Basic/Free without Testimonial";
console.log('type 1 selected');
console.log($w('#text51').html);
$w('#text51').html == $w('#text51').html.replace("#000000","#f65757");
console.log($w('#text51').html);
}
if(itemData.listingLevel == 2) {
$w('#text90').text = "Basic/Free with Testimonial";
console.log('type 2 selected');
console.log($w('#text51').html);
}
if(itemData.listingLevel == 3) {
$w('#text90').text = "Subscription/Paid";
console.log('type 3 selected');
console.log($w('#text51').html);
}
if(itemData.listingLevel == 4) {
$w('#text90').text = "Subscription/Free";
console.log('type 4 selected');
console.log($w('#text51').html);
}
} );
}
Console log of html before and after html.replace code:
type 1 selected
<h4 style="font-size:22px"><span style="font-size:22px"><span style="letter-spacing:0em"><span style="font-family:avenir-lt-w01_85-heavy1475544,avenir-lt-w05_85-heavy,sans-serif"><span style="color:#000000">Group SST</span></span></span></span></h4>
<h4 style="font-size:22px"><span style="font-size:22px"><span style="letter-spacing:0em"><span style="font-family:avenir-lt-w01_85-heavy1475544,avenir-lt-w05_85-heavy,sans-serif"><span style="color:#000000">Group SST</span></span></span></span></h4>