Skip to main content
Participant
April 13, 2023
Question

Adobe will not run custom Javascript

  • April 13, 2023
  • 1 reply
  • 737 views

I'm trying to insert this code into the properties of a button to make my own toggle switch that will cycle between a checkmark and the numerals 1 through 5 upon each click. The Adobe JavaScript editor will not accept my code and gives me this error message: "SyntaxError: missing a ; before statement 1: at line 2". Here's my code:

 

let currentNumber = 1;
let isChecked = false;

function toggleCheckmark() {
if (isChecked) {
isChecked = false;
currentNumber = 1;
} else if (currentNumber === 5) {
isChecked = true;
currentNumber = 1;
} else {
currentNumber++;
}

if (isChecked) {
console.log("✓");
} else {
console.log(currentNumber);
}
}

 

Any suggestions?

This topic has been closed for replies.

1 reply

Bernd Alheit
Community Expert
Community Expert
April 14, 2023

Replace let with var

Where does you use the function toggleCheckmark?

Participant
April 14, 2023

I want to use it in the properties of a button. I'm trying to make a custom selection box that will cylcle through "unselected", a checkmark, and the numerals 1 through 5, with each click. I tried changing let to var and it did not work. Any other suggestins?