Load ajax content with reserved data attributes

Hi, great framework by the way. I’m trying to explore a bit by doing a todo list and i’m trying to create the template in js by adding this on load.

I’m getting this error because the data-action is reserved
index.ts:33 Error parsing descriptor string “task”

Error: Bad action descriptor “task”: Invalid action descriptor syntax

The code is this:

connect() {
$.getJSON('/tasks/', (data) => {
    $.each( JSON.parse(data), ( key, instance ) => {
        $("<li/>", {
            'data-action': 'task#change',
            id: key,
            text: instance.fields.name
        }).appendTo($(this.element))
    });
})

}

How can i do something like this?

You’ll need to specify an event name in your action descriptor:

'data-action': 'click->task#change’,
                ^^^^^^^

because Stimulus doesn’t define a default event for actions on <li> elements.

You can see a full list of default events in the Stimulus handbook.

(I’m sorry the error message you received isn’t more helpful!)

Oh it was my mistake, thanks for the reply and no problem for the message not be so useful. It’s still the 1.0 and I am really enjoying the package.