For Loop Error: Couldnt save during save

You have several errors:

  1. onClick has to be inside $w.onReady block

  2. dataset.onReady should not be inside the loop

  3. dataset.onReady should not beinside an event handler (it may get ready prior to the click

  4. Instead of saving on loop, you’re better change all the items you need and then save them all together with a direct bulkUpdate (then dataset.refresh() to reload the contents).
    https://www.wix.com/velo/reference/wix-data/bulkupdate
    https://www.wix.com/velo/reference/wix-dataset/dataset/refresh