Hi! Im Jose Luis,
i need to create a button who let me add +1 to a field in the database:
Example (as a like button):
In data base i have a column called "Likes" with 6 rows, each row is a style of meat.
what i want to create is a sort of like button. If a member like it, he has to click to the love button, and this one will send a +1 command to the field of this meat.
If before the like value was 0, now is 1, and for each click add +1, so later the value will change to 2, 3 ,4 ,5 etc... the number of times the button has been clicked.
i tried to use many codes of this forum, but none has worked as I wanted.
import wixLocation from 'wix-location'; $w.onReady(function () { let clickCounter = 0 $w('#button1').onClick(()=>{ clickCounter=clickCounter++ console.log(clickCounter) }) });
Take also a look onto the following examples..
https://russian-dima.wixsite.com/meinewebsite/blank-26
and...
https://russian-dima.wixsite.com/meinewebsite/simple-return-function
How to save data, when using DATASETs, you will find an simple example here....
https://russian-dima.wixsite.com/meinewebsite/dublicate-database
And this one is to use without DATASETs...
https://www.wix.com/velo/reference/wix-data/save
Thanks, that's interesting.
Is there any way to stop someone clicking multiple times?