Update Repeater

Hi There!

When a user clicks button3 within a repeater item. The value of the field ‘place’ must increase by 1. and update to the database. I’m pretty new to javascript and I write this code with the API reference. But it doesn’t work!

Can anyone help me?

export function button3_click(event) { //button3 is within the repeater item.
 let $item = $w.at(event.context);
 let item = $item("#dataset1").getCurrentItem();

 let position = item.place;
 let itemid = item._id;
    console.log(position);

 let newPosition = position + 1;
    console.log(newPosition);

    console.log(itemid);
 let toSave = {
 "_id":          itemid,
 "place":        newPosition,
 
 wixData.save("myCollection", toSave);
 
 
};

Your code looks OK, just think you have a problem with updating the repeater. Please show full code.

Is this just for one specific user to do or is it for anybody to use?
If it is for anybody, then check out J.D. reply in this old post here.
https://www.wix.com/corvid/forum/community-discussion/is-there-a-way-to-make-a-button-add-1-to-a-collection-field-everytime-its-pressed

However, please post your full code in a code block so that it can be checked as Giri mentions above.