Adding certain percentage to text field

Looking for code assistance to calculate an additional percentage to a text field once a dollar amount is entered.

Ex: If $40 is entered in text field I’m looking for the code to add a percentage automatically.

Any help would be greatly appreciated. Thank you.

Hello. I would first suggest not using a text field if you are doing calculations but if you do decide to continue with that route, you will want to look up converting a string to a number in JS

To get the value of your input, use .value Editor API Value

Then your math depends on what you are trying to do but might look something like this:

//in this example we are getting 50% of the users input value and storing it in the newValue variable

let newValue = (50 / 100) * input;

And then to set the value once you have performed your calculations you will also use the same API.

I would recommend looking up math operators in javascript to learn more but hopefully this can get you started