Alternatively, I could save the html as a string in the collection, but then how do I display as html in a repeater? I’ve tried the following, but it doesn’t work.
import wixData from ‘wix-data’ ;
$w . onReady ( async function () {
$w ( "#courseRepeater" ). onItemReady (( $item , itemData , index ) => {
$item ( "#courseImage" ). src = itemData . image ;
$item ( "#courseImage" ). alt = itemData . imageAltText ;
$item ( "#titleText" ). text = itemData . title ;
$item ( "#summaryText" ). html = itemData . shortDescription ;
**$item** **(** **"#timesText"** **).** **html** **=** **itemData** **.** **train** **; // train is a text field with html formatting**
});
wixData . query ( "CourseList" )
. contains ( "category" , "k12" )
. ascending ( "title" )
. find ()
. then (( results ) => {
**if** ( results . totalCount > 0 ) {
$w ( "#courseRepeater" ). data = results . items ;
}
})
. **catch** (( error ) => {
console . log ( "Error:" , error . message );
});
})