outputAction
Triggered when an action button on an output card is clicked. This event is fired for both built-in and custom actions.
Event Data
e.command String
The command identifier of the clicked action.
e.outputId String
The unique identifier of the output associated with the action.
e.output String
The output text content associated with the action.
e.prompt String
The prompt text that was used to generate the output.
e.button jQuery
The jQuery element of the clicked button.
Example
<div id="aiprompt"></div>
<script>
$("#aiprompt").kendoAIPrompt({
outputActions: ["copy", "retry", { command: "bookmark", icon: "bookmark" }],
outputAction: function(e) {
console.log("Action:", e.command, "Output ID:", e.outputId, "Output:", e.output, "Prompt:", e.prompt);
if (e.command === "bookmark") {
// Handle custom bookmark action
console.log("Bookmarking output with ID:", e.outputId);
console.log("Output content:", e.output);
console.log("Original prompt:", e.prompt);
return false; // Prevent default handling
}
// Return true or don't return to allow default handling
}
});
</script>
In this article