Search.../

setResourceId( )

Retrieves a comment thread with a unique resource ID, or creates one if it doesn't exist.

Description

The setResourceId() function replaces the comments thread in the WixComments element with a different comment thread. You can create new comment threads and transition between threads by calling the function.

Each comment thread is referenced by a unique resource ID that is arbitrarily chosen when the function is first called on that thread.

Syntax

function setResourceId(resourceId: string): void

setResourceId Parameters

NAME
TYPE
DESCRIPTION
resourceId
string

The unique resource ID for the new comment thread.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Set a comment thread resource ID

Copy Code
1$w("#myCommentsWidget").setResourceId("thread-2");
Navigate between comment threads using button clicks

Copy Code
1// Set the resourceId to an image on the page.
2$w("#myButton2").onClick(() => {
3 $w("#myCommentsWidget").setResourceId("sunsetImage");
4});