Search...
onCommentCreate( )
Adds an event handler that runs when a new comment is created in the WixComments
element.
Description
The onCommentCreate()
function sets a callback function that is called when a new comment is created in the WixComments
element.
Syntax
function onCommentCreate(callback: OnCommentCreateCallback): Promise<void>callback: function OnCommentCreateCallback(comment: WidgetComment): void
onCommentCreate Parameters
NAME
TYPE
DESCRIPTION
Returns
Return Type:
Promise<void>
OnCommentCreateCallback Parameters
NAME
TYPE
DESCRIPTION
comment
WidgetComment
The comment being created by the WixComments
element.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
Add an event handler for when a new comment is created
Copy Code
1$w("#myCommentsWidget").onCreateComment((widgetComment) => {2 console.log(widgetComment);3});