Hi J. D.,
Thank you for reaching out - very much appreciated! We’ve actually been working on the code a little more and edited to this:
import wixUsers from ‘wix-users’ ;
$w . onReady ( function () {
$w ( "#voteButton" ). onClick ( ( event ) => {
**let** $item = $w . at ( event . context );
**if** ( wixUsers . currentUser . loggedIn ) { // if the user is logged in
**let** currentArtwork = $item ( "#dataset1" ). getCurrentItem ();
**let** currentVotes = Number ( currentArtwork . Votes );
$item ( "#dataset1" ). setFieldValue ( "Votes" , currentVotes + 1 );
$item ( "#dataset1" ). save ();
$w ( "#voteButton" ). hide ();
$w ( "#voteConf" ). show ();
$w ( "#text64" ). text = "One vote per e-mail address" ;
}
**else** { // the user isn't logged in
$w ( "#voteConf" ). show ();
$w ( "#box1" ). hide ();
$w ( "#voteConf" ). text = " LOGIN REQUIRED TO VOTE " ;
wixUsers . promptLogin ()
$w ( "#voteConf" ). hide ();
$w ( "#voteConf" ). text = " VOTE COUNTED! " ;
$w ( "#box1" ). show ();
}
} );
});