Changing a button text based on a variable value

Got a driving me nuts moment.

I am trying to change the text on a button based on the value of a variable on the page.

Pretty simple really but just can’t work out how to do it?

I can change text based on a checkbox or radio button etc… but how do you do the above?

Variable stores numbers 1 to 5. If the number is not != 5 then button is ‘Save’

I know it must be a tertiary condition on the text in the button but no matter what I try just can’t work out what its supposed to be?

If by this you mean the value is not equal to 5, then use:

email_type.value != 5 ? 'Save' : 'Other Value'
1 Like

That’s it!

Awesome thanks!

I was close but no cigar :nerd_face:!

Makes sense when you see it like this.

1 Like